memblock_phys_alloc_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… memblock_phys_alloc_range(9) β€” Kernel API Manual, bestie edition ✨

okay so this is a page straight out of the Kernel API Manual, and it's about memblock_phys_alloc_range β€” a function that literally goes "here's a chunk of physical memory, but like… only inside this specific range, mwah πŸ’‹". no cap, it's giving "picky real-estate agent energy" and honestly? obsessed. πŸŽ€


✨ NAME ✨

memblock_phys_alloc_range β€” allocate a memory block inside a specified range πŸ¦‹


🌸 SYNOPSIS 🌸

phys_addr_t memblock_phys_alloc_range (phys_addr_t size , phys_addr_t align , phys_addr_t start , phys_addr_t end );

like yes bestie it takes four args and returns a phys_addr_t, we love a consistent signature πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • size β€” how big the memory block you're allocating is, in bytes. this is the "how much snack do u want" number πŸ“
  • align β€” the alignment of the region and of the block's size. yes both. it's a package deal, periodt ✨
  • start β€” the lower bound of the memory region you're allocating from, as a physical address 🫢
  • end β€” the upper bound of the memory region you're allocating from, as a physical address 🌈

🧚 DESCRIPTION 🧚

allocate size bytes in between start and end. that's it, that's the whole vibe check πŸ’œ literally carve out size bytes somewhere in that window and you're slaying.


⭐ RETURN ⭐

the physical address of the allocated memory block on success πŸ’… β€” and 0 on failure 😭 (yes, zero is the "nope, didn't happen" signal, don't @ me).


πŸ¦‹ SEE ALSO πŸ¦‹

the main character herself lives in the kernel file ./mm/memblock.c, and here's the whole group chat of related pages β€” every single one, no gatekeeping πŸ‘‘:


πŸ’€ reminder bestie: this page is from ./mm and it's dated October 2026 β€” so if you're reading it, congrats, you're officially caught up. mwah, go allocate responsibly πŸ˜˜πŸ’–

signed, your favorite kernel bestie πŸŽ€βœ¨ 🫢

πŸ“¦ where this page comes from