memblock_alloc_try_nid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

memblock_alloc_try_nid β€” bestie, this is the one that allocates a boot memory block πŸ’–


✨ SYNOPSIS ✨

void * memblock_alloc_try_nid (phys_addr_t size , phys_addr_t align ,
       phys_addr_t min_addr , phys_addr_t max_addr , int nid );

okay so she takes five things and gives you back a pointer, slay 🫢


πŸ’… ARGUMENTS πŸ’…

  • size β€” how big the memory block you want is, in bytes. literally the size, that's it πŸŽ€
  • align β€” the alignment of the region and the block's size. yes both. she's thorough ✨
  • min_addr β€” the lower bound of the memory region where you'd prefer the allocation to land (physical address, iykyk) 🌸
  • max_addr β€” the upper bound of that same preferred region (physical address again), or you can pass MEMBLOCK_ALLOC_ACCESSIBLE and then it only allocates from memory limited by the memblock.current_limit value πŸ”₯
  • nid β€” the nid of the free area to go find, or NUMA_NO_NODE if you're chill with literally any node πŸ¦‹

πŸ‘‘ DESCRIPTION πŸ‘‘

She's a public function, so everyone can call her, and no cap she provides extra debugging info (including caller info) if that's enabled πŸ’€

Also, important: this function zeroes the allocated memory ✨ every byte, squeaky clean, no leftover vibes.


🌈 RETURN 🌈

Virtual address of the allocated memory block on success πŸ’– NULL on failure 😭 (she is not okay, and neither are you).


🧚 SEE ALSO 🧚

Kernel file ./mm/memblock.c, plus the whole friend group, fr fr:


and that's the whole thing bestie πŸ’œ this page lives in ./mm and was dated October 2026, mwah, go allocate something iconic βœ¨πŸŽ€

πŸ“¦ where this page comes from