include/linux/bootmem_info.h
Source file repositories/reference/linux-study-clean/include/linux/bootmem_info.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/bootmem_info.h- Extension
.h- Size
- 2171 bytes
- Lines
- 90
- 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/mm.hlinux/kmemleak.h
Detected Declarations
enum bootmem_typefunction bootmem_typefunction bootmem_infofunction free_bootmem_pagefunction register_page_bootmem_info_nodefunction bootmem_infofunction get_page_bootmem
Annotated Snippet
#ifndef __LINUX_BOOTMEM_INFO_H
#define __LINUX_BOOTMEM_INFO_H
#include <linux/mm.h>
#include <linux/kmemleak.h>
/*
* Types for free bootmem stored in the low bits of page->private.
*/
enum bootmem_type {
MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 1,
SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
MIX_SECTION_INFO,
NODE_INFO,
MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
};
#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE
void __init register_page_bootmem_info_node(struct pglist_data *pgdat);
void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
unsigned long nr_pages);
void get_page_bootmem(unsigned long info, struct page *page,
enum bootmem_type type);
void put_page_bootmem(struct page *page);
static inline enum bootmem_type bootmem_type(const struct page *page)
{
return (unsigned long)page->private & 0xf;
}
static inline unsigned long bootmem_info(const struct page *page)
{
return (unsigned long)page->private >> 4;
}
/*
* Any memory allocated via the memblock allocator and not via the
* buddy will be marked reserved already in the memmap. For those
* pages, we can call this function to free it to buddy allocator.
*/
static inline void free_bootmem_page(struct page *page)
{
enum bootmem_type type = bootmem_type(page);
VM_BUG_ON_PAGE(page_ref_count(page) != 2, page);
if (type == SECTION_INFO || type == MIX_SECTION_INFO)
put_page_bootmem(page);
else
VM_BUG_ON_PAGE(1, page);
}
#else
static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
{
}
static inline void register_page_bootmem_memmap(unsigned long section_nr,
struct page *map, unsigned long nr_pages)
{
}
static inline void put_page_bootmem(struct page *page)
{
}
static inline enum bootmem_type bootmem_type(const struct page *page)
{
return SECTION_INFO;
}
static inline unsigned long bootmem_info(const struct page *page)
{
return 0;
}
static inline void get_page_bootmem(unsigned long info, struct page *page,
enum bootmem_type type)
{
}
static inline void free_bootmem_page(struct page *page)
{
free_reserved_page(page);
}
#endif
#endif /* __LINUX_BOOTMEM_INFO_H */
Annotation
- Immediate include surface: `linux/mm.h`, `linux/kmemleak.h`.
- Detected declarations: `enum bootmem_type`, `function bootmem_type`, `function bootmem_info`, `function free_bootmem_page`, `function register_page_bootmem_info_node`, `function bootmem_info`, `function get_page_bootmem`.
- 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.