ENUM MEMBLOCK_FLAGS(9)
π enum memblock_flags(9) β¨
okay so bestie, welcome to the Kernel API Manual entry for enum memblock_flags(9) β this is lowkey the vibe-check list for memory region attributes, and tbh once you get it you'll be obsessed π«Ά
πΈ NAME πΈ
enum memblock_flags β the definition of memory region attributes, like literally the whole personality chart for memblock regions π
β¨ SYNOPSIS β¨
enum memblock_flags {
MEMBLOCK_NONE ,
MEMBLOCK_HOTPLUG ,
MEMBLOCK_MIRROR ,
MEMBLOCK_NOMAP ,
MEMBLOCK_DRIVER_MANAGED ,
MEMBLOCK_RSRV_NOINIT ,
MEMBLOCK_RSRV_KERN ,
MEMBLOCK_KHO_SCRATCH ,
MEMBLOCK_RSRV_HUGETLB
};
π Constants π
okay so this is the main character lineup, one flag at a time, no skipping, periodt π
MEMBLOCK_NONEβ no special request. it's giving "default settings, no notes," the plain unflavored girlie of memblock flags β¨MEMBLOCK_HOTPLUGβ a memory region that the firmware-provided memory map indicated during early boot as hot(un)pluggable system RAM (like, a memory range that might get hotunplugged later π). when"movable_node"is set on the kernel commandline, it tries to keep this memory region hotunpluggable. important: this does not apply to memblocks that get added ("hotplugged") after early boot π«ΆMEMBLOCK_MIRRORβ mirrored region. that's it, that's the whole description, we love a minimal icon πMEMBLOCK_NOMAPβ don't add it to the kernel direct mapping, and treat it as reserved in the memory map. for the full tea, refer to thememblock_mark_nomapdescription π¦MEMBLOCK_DRIVER_MANAGEDβ a memory region that is always detected and added via a driver, and is never indicated in the firmware-provided memory map as system RAM. this corresponds toIORESOURCE_SYSRAM_DRIVER_MANAGEDin the kernel resource tree. driver girlies stay winning πMEMBLOCK_RSRV_NOINITβ a reserved memory region where the struct pages are not fully initialized π users of this flag are the ones responsible for properly initializing the struct pages of this region. so like, don't just set it and ghost it, bestie πΈMEMBLOCK_RSRV_KERNβ a memory region reserved for kernel use, either explicitly withmemblock_reserve_kernor via the memblock allocation APIs. and fr fr, all memblock allocations set this flag. no cap π₯MEMBLOCK_KHO_SCRATCHβ a memory region thatkexeccan pass to the next kernel in handover mode. during early boot we don't know about all the memory reservations yet, so we get scratch memory from the previous kernel that we know is good to use. it's literally the only memory that allocations may happen from in this phase βMEMBLOCK_RSRV_HUGETLBβ memory is reserved for hugetlb pages. big pages, big vibes ππ
ngl, misspelling moment alert: the original text of MEMBLOCK_RSRV_KERN says "explictitly" β that's the source's own typo, we're just preserving the energy, don't come for me π
π SEE ALSO π
kernel file ./include/linux/memblock.h, plus the whole friend group:
struct memblock_region(9)struct memblock_type(9)struct memblock(9)for_each_physmem_range(9)__for_each_mem_range(9)__for_each_mem_range_rev(9)for_each_mem_range(9)for_each_mem_range_rev(9)for_each_reserved_mem_range(9)for_each_mem_pfn_range(9)for_each_free_mem_range(9)for_each_free_mem_range_reverse(9)memblock_set_current_limit(9)memblock_region_memory_base_pfn(9)memblock_region_memory_end_pfn(9)memblock_region_reserved_base_pfn(9)memblock_region_reserved_end_pfn(9)for_each_mem_region(9)for_each_reserved_mem_region(9)
that's the whole page bestie, you ate that ππ
and before you go β this iconic little doc lives under ./include/linux in the source tree, and it's dated October 2026. screenshot it, frame it, put it on your fridge, iykyk πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms