include/linux/memblock.h
Source file repositories/reference/linux-study-clean/include/linux/memblock.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/memblock.h- Extension
.h- Size
- 22097 bytes
- Lines
- 641
- 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.
- 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/init.hlinux/mm.hasm/dma.h
Detected Declarations
struct memblock_regionstruct memblock_typestruct memblockenum memblock_flagsfunction memblock_discardfunction memblock_reservefunction memblock_reserve_kernfunction __next_physmem_rangefunction __next_mem_range_revfunction memblock_is_mirrorfunction memblock_is_nomapfunction memblock_is_reserved_noinitfunction memblock_is_driver_managedfunction memblock_is_kho_scratchfunction memblock_set_region_nodefunction memblock_get_region_nodefunction memblock_set_region_nodefunction memblock_phys_allocfunction __memblock_alloc_or_panicfunction memblock_set_bottom_upfunction memblock_bottom_upfunction memblock_region_memory_base_pfnfunction memblock_region_memory_end_pfnfunction memblock_region_reserved_base_pfnfunction memblock_region_reserved_end_pfnfunction early_memtestfunction kho_scratch_migratetypefunction memblock_set_kho_scratch_onlyfunction kho_scratch_migratetype
Annotated Snippet
struct memblock_region {
phys_addr_t base;
phys_addr_t size;
enum memblock_flags flags;
#ifdef CONFIG_NUMA
int nid;
#endif
};
/**
* struct memblock_type - collection of memory regions of certain type
* @cnt: number of regions
* @max: size of the allocated array
* @total_size: size of all regions
* @regions: array of regions
* @name: the memory type symbolic name
*/
struct memblock_type {
unsigned long cnt;
unsigned long max;
phys_addr_t total_size;
struct memblock_region *regions;
char *name;
};
/**
* struct memblock - memblock allocator metadata
* @bottom_up: is bottom up direction?
* @current_limit: physical address of the current allocation limit
* @memory: usable memory regions
* @reserved: reserved memory regions
*/
struct memblock {
bool bottom_up; /* is bottom up direction? */
phys_addr_t current_limit;
struct memblock_type memory;
struct memblock_type reserved;
};
extern struct memblock memblock;
#ifndef CONFIG_ARCH_KEEP_MEMBLOCK
#define __init_memblock __meminit
#define __initdata_memblock __meminitdata
void memblock_discard(void);
#else
#define __init_memblock
#define __initdata_memblock
static inline void memblock_discard(void) {}
#endif
void memblock_allow_resize(void);
int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid,
enum memblock_flags flags);
int memblock_add(phys_addr_t base, phys_addr_t size);
int memblock_remove(phys_addr_t base, phys_addr_t size);
int memblock_phys_free(phys_addr_t base, phys_addr_t size);
int __memblock_reserve(phys_addr_t base, phys_addr_t size, int nid,
enum memblock_flags flags);
static __always_inline int memblock_reserve(phys_addr_t base, phys_addr_t size)
{
return __memblock_reserve(base, size, NUMA_NO_NODE, 0);
}
static __always_inline int memblock_reserve_kern(phys_addr_t base, phys_addr_t size)
{
return __memblock_reserve(base, size, NUMA_NO_NODE, MEMBLOCK_RSRV_KERN);
}
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
int memblock_physmem_add(phys_addr_t base, phys_addr_t size);
#endif
void memblock_trim_memory(phys_addr_t align);
unsigned long memblock_addrs_overlap(phys_addr_t base1, phys_addr_t size1,
phys_addr_t base2, phys_addr_t size2);
bool memblock_overlaps_region(struct memblock_type *type,
phys_addr_t base, phys_addr_t size);
bool memblock_validate_numa_coverage(unsigned long threshold_bytes);
int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
int memblock_reserved_mark_noinit(phys_addr_t base, phys_addr_t size);
int memblock_reserved_mark_kern(phys_addr_t base, phys_addr_t size);
int memblock_mark_kho_scratch(phys_addr_t base, phys_addr_t size);
int memblock_clear_kho_scratch(phys_addr_t base, phys_addr_t size);
void memblock_free(void *ptr, size_t size);
Annotation
- Immediate include surface: `linux/init.h`, `linux/mm.h`, `asm/dma.h`.
- Detected declarations: `struct memblock_region`, `struct memblock_type`, `struct memblock`, `enum memblock_flags`, `function memblock_discard`, `function memblock_reserve`, `function memblock_reserve_kern`, `function __next_physmem_range`, `function __next_mem_range_rev`, `function memblock_is_mirror`.
- 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.