memblock_insert_region(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– memblock_insert_region(9) β€” insert new memblock region πŸ’–

okay bestie, so this is a page straight out of the Kernel API Manual ✨ and it's giving "small function, big responsibility" energy. Meet memblock_insert_region, the little void that slides a brand new region into the memblock table. No cap. 🫢


✨ SYNOPSIS ✨

void __init_memblock memblock_insert_region (struct memblock_type *type
, int idx , phys_addr_t base , phys_addr_t size , int nid , enum
memblock_flags flags );

literally five args and a return type of void, she doesn't even give you a status code back 😭 you just gotta trust her.


πŸŽ€ ARGUMENTS πŸŽ€

  • type β€” the memblock type you're inserting into. this is your destination table, the main character πŸ’…
  • idx β€” the index for the insertion point. i.e. where in the table she gets slotted in, bestie πŸ“
  • base β€” base address of the new region. the starting coordinate, the origin story ⭐
  • size β€” size of the new region. how much address space she's claiming for herself πŸ”₯
  • nid β€” node id of the new region. which NUMA node she belongs to, iykyk 🌸
  • flags β€” flags of the new region. her whole personality basically, it's an enum memblock_flags πŸ¦‹

πŸ’œ DESCRIPTION πŸ’œ

Insert new memblock region [base, base + size) into type at idx. yes the interval is half-open, so base is in and base + size is out, that's just how she rolls πŸŽ€

🚨 the one thing you cannot skip, fr fr: type must already have extra room to accommodate the new region. this function does not grow anything for you. she does not check. she does not expand the array. she just inserts. so if you show up with a full table, that's on you bestie πŸ’€

like, she's an inserter, not a grower. memblock_double_array(9) is right there in SEE ALSO if you need more space β€” just saying πŸ‘€


πŸ¦‹ SEE ALSO πŸ¦‹

the whole memblock friend group, they all hang out in the kernel file ./mm/memblock.c plus the memblock overview(9):


and that's the whole page, bestie, you ate that πŸ“ this one comes to you from ./mm and it's dated October 2026 β€” so yes, she's from the future, we stan a forward-thinking queen πŸ‘‘πŸ’– mwah, go insert some regions responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from