arch/x86/mm/pat/memtype_interval.c
Source file repositories/reference/linux-study-clean/arch/x86/mm/pat/memtype_interval.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/mm/pat/memtype_interval.c- Extension
.c- Size
- 3792 bytes
- Lines
- 150
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/seq_file.hlinux/debugfs.hlinux/kernel.hlinux/interval_tree_generic.hlinux/sched.hlinux/gfp.hlinux/pgtable.hasm/memtype.hmemtype.h
Detected Declarations
function tablesfunction interval_endfunction memtype_check_conflictfunction memtype_check_insertfunction memtype_copy_nth_element
Annotated Snippet
if (entry->start == start && entry->end == end) {
interval_remove(entry, &memtype_rbroot);
return entry;
}
entry = interval_iter_next(entry, start, end - 1);
}
return ERR_PTR(-EINVAL);
}
struct memtype *memtype_lookup(u64 addr)
{
return interval_iter_first(&memtype_rbroot, addr, addr + PAGE_SIZE-1);
}
/*
* Debugging helper, copy the Nth entry of the tree into a
* a copy for printout. This allows us to print out the tree
* via debugfs, without holding the memtype_lock too long:
*/
#ifdef CONFIG_DEBUG_FS
int memtype_copy_nth_element(struct memtype *entry_out, loff_t pos)
{
struct memtype *entry_match;
int i = 1;
entry_match = interval_iter_first(&memtype_rbroot, 0, ULONG_MAX);
while (entry_match && pos != i) {
entry_match = interval_iter_next(entry_match, 0, ULONG_MAX);
i++;
}
if (entry_match) { /* pos == i */
*entry_out = *entry_match;
return 0;
} else {
return 1;
}
}
#endif
Annotation
- Immediate include surface: `linux/seq_file.h`, `linux/debugfs.h`, `linux/kernel.h`, `linux/interval_tree_generic.h`, `linux/sched.h`, `linux/gfp.h`, `linux/pgtable.h`, `asm/memtype.h`.
- Detected declarations: `function tables`, `function interval_end`, `function memtype_check_conflict`, `function memtype_check_insert`, `function memtype_copy_nth_element`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
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.