mm/debug.c
Source file repositories/reference/linux-study-clean/mm/debug.c
File Facts
- System
- Linux kernel
- Corpus path
mm/debug.c- Extension
.c- Size
- 9157 bytes
- Lines
- 365
- Domain
- Core OS
- Bucket
- Memory Management
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/mm.hlinux/trace_events.hlinux/memcontrol.htrace/events/mmflags.hlinux/migrate.hlinux/page_owner.hlinux/ctype.hinternal.htrace/events/migrate.h
Detected Declarations
function __dump_foliofunction __dump_pagefunction dump_pagefunction dump_vmafunction dump_mmfunction dump_vmgfunction setup_vm_debugfunction page_init_poisonfunction vma_iter_dump_treeexport dump_pageexport dump_vmaexport dump_mmexport dump_vmg
Annotated Snippet
switch (tolower(*str)) {
case 'p':
__page_init_poisoning = true;
break;
default:
pr_err("vm_debug option '%c' unknown. skipped\n",
*str);
}
str++;
}
out:
if (page_init_poisoning && !__page_init_poisoning)
pr_warn("Page struct poisoning disabled by kernel command line option 'vm_debug'\n");
page_init_poisoning = __page_init_poisoning;
return 1;
}
__setup("vm_debug", setup_vm_debug);
void page_init_poison(struct page *page, size_t size)
{
if (page_init_poisoning)
memset(page, PAGE_POISON_PATTERN, size);
}
void vma_iter_dump_tree(const struct vma_iterator *vmi)
{
#if defined(CONFIG_DEBUG_VM_MAPLE_TREE)
mas_dump(&vmi->mas);
mt_dump(vmi->mas.tree, mt_dump_hex);
#endif /* CONFIG_DEBUG_VM_MAPLE_TREE */
}
#endif /* CONFIG_DEBUG_VM */
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/mm.h`, `linux/trace_events.h`, `linux/memcontrol.h`, `trace/events/mmflags.h`, `linux/migrate.h`, `linux/page_owner.h`, `linux/ctype.h`.
- Detected declarations: `function __dump_folio`, `function __dump_page`, `function dump_page`, `function dump_vma`, `function dump_mm`, `function dump_vmg`, `function setup_vm_debug`, `function page_init_poison`, `function vma_iter_dump_tree`, `export dump_page`.
- Atlas domain: Core OS / Memory Management.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.