__memblock_f...nge_top_down(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __memblock_find_range_top_down β€” Kernel API Manual ✨

okay bestie, so this page lives in the kernel API manual, the function is __memblock_find_range_top_down, and it's literally the finder-of-free-space that starts from the top and works its way down. no cap. 🫢


✨ NAME ✨

__memblock_find_range_top_down β€” find free area utility, in top-down 🌈


πŸŽ€ SYNOPSIS πŸŽ€

phys_addr_t __init_memblock __memblock_find_range_top_down (phys_addr_t
start , phys_addr_t end , phys_addr_t size , phys_addr_t align , int nid
, enum memblock_flags flags );

like, look at her. phys_addr_t return type, __init_memblock on the front, six whole arguments. main character energy honestly πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • start β€” start of candidate range. the beginning, the origin story, where we start looking πŸ¦‹
  • end β€” end of candidate range, and it can be MEMBLOCK_ALLOC_ANYWHERE or MEMBLOCK_ALLOC_ACCESSIBLE. yes those are the two special values, write them down πŸ“
  • size β€” size of free area to find. how much room you're hunting for, no more no less πŸ’…
  • align β€” alignment of free area to find. she has standards, the address must line up ✨
  • nid β€” nid of the free area to find, and NUMA_NO_NODE means "any node, idc, surprise me" πŸ™ˆ
  • flags β€” pick from blocks based on memory attributes ⭐

🌸 DESCRIPTION 🌸

so this is a utility that gets called from memblock_find_in_range_node, and it finds a free area top-down. that's it, that's the whole vibe. πŸ’€

lowkey iconic how short this description is. the function does one thing and does it slay.

πŸ’œ RETURN πŸ’œ

Found address on success, 0 on failure. so like, if it comes back with 0? that's a no. that's a failure bestie, don't get it twisted 😭


πŸ”₯ SEE ALSO πŸ”₯

the whole memblock friend group, fr fr β€” every single one of them πŸ’–


anyway that's the page!! this one comes from ./mm, dated October 2026, and it's filed under __memblock_f...nge_top_down(9) in the kernel API manual. go find your free area top-down and slay, bestie πŸ’…πŸŽ€πŸ’–

πŸ“¦ where this page comes from