for_each_mem_pfn_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« for_each_mem_pfn_range πŸ’«

okay so bestie, welcome to the Kernel API Manual, section 9 β€” yes we're literally in the kernel docs and it's giving big-brain energy. this page is about for_each_mem_pfn_range, and no cap, it's a whole vibe once you get it.


✨ NAME ✨

for_each_mem_pfn_range β€” early memory pfn range iterator πŸ¦‹

like, it walks your early memory ranges for you so you don't have to. main character behavior fr fr.


πŸŽ€ SYNOPSIS πŸŽ€

for_each_mem_pfn_range (i , nid , p_start , p_end , p_nid );

that's the whole invocation, slay. keep it exactly like that πŸ’…


🌸 ARGUMENTS 🌸

  • i β€” an integer used as loop variable. yep, your classic loop counter, iconic, does exactly what it says πŸ”
  • nid β€” node selector. pass MAX_NUMNODES if you want all the nodes, no picking favorites πŸ’–
  • p_start β€” ptr to ulong for start pfn of the range. and good news: it can be NULL πŸ™ˆ
  • p_end β€” ptr to ulong for end pfn of the range. also can be NULL, we love flexibility ✨
  • p_nid β€” ptr to int for nid of the range. can be NULL too, all three of the ptrs are optional like that 🫢

πŸ”₯ DESCRIPTION πŸ”₯

Walks over configured memory ranges. that's it, that's the whole thing β€” lowkey simple, highkey useful 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file is ./include/linux/memblock.h β€” go touch it, it's where the lore lives πŸ“– and also these absolute icons:

like, that's a whole friend group right there πŸ’€πŸ’œ


ngl bestie, just remember the ptrs can be NULL and MAX_NUMNODES means "all the nodes" β€” that's the whole vibe check βœ…

and that's the page! sourced from ./include/linux, dated October 2026, and it's literally the for_each_mem_pfn_range(9) page. mwah, go iterate some pfns πŸ’‹πŸŽ€πŸŒŸ

πŸ“¦ where this page comes from