ENUM MEMBLOCK_FLAGS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the memblock_mark_nomap description πŸ¦‹
  • 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 to IORESOURCE_SYSRAM_DRIVER_MANAGED in 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 with memblock_reserve_kern or via the memblock allocation APIs. and fr fr, all memblock allocations set this flag. no cap πŸ”₯
  • MEMBLOCK_KHO_SCRATCH β€” a memory region that kexec can 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:


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