__for_each_mem_range_rev(9)
π __for_each_mem_range_rev(9) β¨
okay so bestie, welcome to the Kernel API Manual π«Ά β this one's a macro page, and it's lowkey iconic. buckle up.
π NAME π
__for_each_mem_range_rev β reverse iterate through memblock areas from type_a and not included in type_b. Or just type_a if type_b is NULL. π¦
like... it walks backwards through your memblock areas, and it'll filter out whatever's in type_b. and if type_b is NULL? no filtering, we just vibe with type_a alone. periodt.
β¨ SYNOPSIS β¨
__for_each_mem_range_rev (i , type_a , type_b , nid , flags , p_start ,
p_end , p_nid );
eight arguments, no cap. let's get into them π
πΈ ARGUMENTS πΈ
iβ au64used as the loop variable. it's the main character of the iteration, honestly πtype_aβ ptr tomemblock_typeto iterate. this is the one we're actually walking through π«type_bβ ptr tomemblock_typewhich excludes from the iteration. it's giving "you're not invited to the party" energy πnidβ node selector, useNUMA_NO_NODEfor all nodes. all of them, bestie, we're not picking favorites πflagsβ pick from blocks based on memory attributes. this is your vibe check for which blocks make the cut β¨p_startβ ptr tophys_addr_tfor start address of the range, can beNULL. no pressure if you don't wanna pass it π«Άp_endβ ptr tophys_addr_tfor end address of the range, can beNULL. same deal, optional and valid πp_nidβ ptr tointfor nid of the range, can beNULL. three out of three optional pointers, we love a flexible icon π
ngl, those last three being nullable is a whole mood β pass them if you want the info, skip them if you don't. the macro does not care. π
π₯ SEE ALSO π₯
all the sibling macros and structs, fr fr β go read them, they're literally family:
Kernel file ./include/linux/memblock.h enum memblock_flags(9), struct memblock_region(9), struct memblock_type(9), struct memblock(9), for_each_physmem_range(9), __for_each_mem_range(9), for_each_mem_range(9), for_each_mem_range_rev(9), for_each_reserved_mem_range(9), for_each_mem_pfn_range(9), for_each_free_mem_range(9), for_each_free_mem_range_reverse(9), memblock_set_current_limit(9), memblock_region_memory_base_pfn(9), memblock_region_memory_end_pfn(9), memblock_region_reserved_base_pfn(9), memblock_region_reserved_end_pfn(9), for_each_mem_region(9), for_each_reserved_mem_region(9)
that's nineteen references, bestie. nineteen. ate and left no crumbs π
π§ sign-off π§
this lil masterpiece lives in ./include/linux, dated October 2026, and it's forever known as __for_each_mem_range_rev(9). mwah π go iterate backwards, you've got this π₯π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms