for_each_fr...ange_reverse(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… for_each_fr...ange_reverse(9) πŸ’…

okay so welcome to the Kernel API Manual, bestie β€” the for_each_fr...ange_reverse(9) page and yes the name is literally abbreviated with dots in the header, that's not a typo, that's just how the man page title renders. we move. πŸ¦‹


✨ NAME ✨

for_each_free_mem_range_reverse β€” rev-iterate through free memblock areas πŸ’–

like, you go through them backwards, it's giving reverse chronological but for memory regions.


🌸 SYNOPSIS 🌸

for_each_free_mem_range_reverse (i , nid , flags , p_start , p_end ,
p_nid );

that's the whole call, keep the spacing exactly like that, no cap. ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” u64 used as loop variable. it's the little counter guy that just chugs along, being a loop variable, main character energy honestly. 🫢
  • nid β€” node selector, and NUMA_NO_NODE means all nodes. so if you want everything everywhere, that's your girl. πŸ‘‘
  • flags β€” pick from blocks based on memory attributes. you're choosing which blocks qualify, based on their attributes, okurrr. 🌈
  • p_start β€” ptr to phys_addr_t for start address of the range, and yes it can be NULL. no pressure. πŸ™ˆ
  • p_end β€” ptr to phys_addr_t for end address of the range, also can be NULL. equally chill. πŸ™ˆ
  • p_nid β€” ptr to int for nid of the range, and yep, can be NULL too. three for three, slay. πŸ’œ

πŸ¦‹ DESCRIPTION πŸ¦‹

so what it does: it walks over free areas of memblock β€” and "free" here means literally memory && !reserved, iykyk, not reserved, just memory β€” and it does that walk in reverse order. back it up, back it up. πŸ”₯

and the cute part? it's available as soon as memblock is initialized. no waiting around, it's ready early, lowkey iconic. ⭐


πŸ’€ SEE ALSO πŸ’€

Kernel file ./include/linux/memblock.h, plus the whole friend group:

that's a lot of friends and honestly? obsessed. πŸ’…


πŸ’– cute little sign-off: this page lives at ./include/linux and it's dated October 2026, so yeah, timestamped and everything. go forth and rev-iterate, bestie. 🧚✨
πŸ“¦ where this page comes from