include/linux/page_ext.h
Source file repositories/reference/linux-study-clean/include/linux/page_ext.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/page_ext.h- Extension
.h- Size
- 5570 bytes
- Lines
- 229
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/mmzone.hlinux/stacktrace.h
Detected Declarations
struct pglist_datastruct page_ext_operationsstruct page_extstruct page_ext_iterstruct page_extenum page_ext_flagsfunction early_page_ext_enabledfunction page_ext_init_flatmemfunction page_ext_init_flatmem_latefunction page_ext_initfunction page_ext_iter_beginfunction page_ext_iter_nextfunction page_ext_iter_getfunction early_page_ext_enabledfunction pgdat_page_ext_initfunction page_ext_put
Annotated Snippet
struct page_ext_operations {
size_t offset;
size_t size;
bool (*need)(void);
void (*init)(void);
bool need_shared_flags;
};
/*
* The page_ext_flags users must set need_shared_flags to true.
*/
enum page_ext_flags {
PAGE_EXT_OWNER,
PAGE_EXT_OWNER_ALLOCATED,
#if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT)
PAGE_EXT_YOUNG,
PAGE_EXT_IDLE,
#endif
};
/*
* Page Extension can be considered as an extended mem_map.
* A page_ext page is associated with every page descriptor. The
* page_ext helps us add more information about the page.
* All page_ext are allocated at boot or memory hotplug event,
* then the page_ext for pfn always exists.
*/
struct page_ext {
unsigned long flags;
};
extern bool early_page_ext;
extern unsigned long page_ext_size;
extern void pgdat_page_ext_init(struct pglist_data *pgdat);
static inline bool early_page_ext_enabled(void)
{
return early_page_ext;
}
#ifdef CONFIG_SPARSEMEM
static inline void page_ext_init_flatmem(void)
{
}
extern void page_ext_init(void);
static inline void page_ext_init_flatmem_late(void)
{
}
static inline bool page_ext_iter_next_fast_possible(unsigned long next_pfn)
{
/*
* page_ext is allocated per memory section. Once we cross a
* memory section, we have to fetch the new pointer.
*/
return next_pfn % PAGES_PER_SECTION;
}
#else
extern void page_ext_init_flatmem(void);
extern void page_ext_init_flatmem_late(void);
static inline void page_ext_init(void)
{
}
static inline bool page_ext_iter_next_fast_possible(unsigned long next_pfn)
{
return true;
}
#endif
extern struct page_ext *page_ext_get(const struct page *page);
extern struct page_ext *page_ext_from_phys(phys_addr_t phys);
extern void page_ext_put(struct page_ext *page_ext);
extern struct page_ext *page_ext_lookup(unsigned long pfn);
static inline void *page_ext_data(struct page_ext *page_ext,
struct page_ext_operations *ops)
{
return (void *)(page_ext) + ops->offset;
}
static inline struct page_ext *page_ext_next(struct page_ext *curr)
{
void *next = curr;
next += page_ext_size;
return next;
}
struct page_ext_iter {
unsigned long index;
Annotation
- Immediate include surface: `linux/types.h`, `linux/mmzone.h`, `linux/stacktrace.h`.
- Detected declarations: `struct pglist_data`, `struct page_ext_operations`, `struct page_ext`, `struct page_ext_iter`, `struct page_ext`, `enum page_ext_flags`, `function early_page_ext_enabled`, `function page_ext_init_flatmem`, `function page_ext_init_flatmem_late`, `function page_ext_init`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.