__next_mem_range_rev(9)
π
__next_mem_range_rev(9) β a Kernel API Manual moment
okay so bestie, welcome to the Kernel API Manual page for __next_mem_range_rev β yes it's a mouthful, no we're not renaming it, it's iconic as-is π
β¨ NAME β¨
__next_mem_range_rev β the generic next function for for_each_*_range_rev(). that's it, that's the whole vibe. she's a helper. she helps. π
π¦ SYNOPSIS π¦
void __init_memblock __next_mem_range_rev (u64 *idx , int nid , enum
memblock_flags flags , struct memblock_type *type_a , struct
memblock_type *type_b , phys_addr_t *out_start , phys_addr_t *out_end ,
int *out_nid );
literally just look at her. seven whole parameters. main character energy, no cap π
πΈ ARGUMENTS πΈ
idxβ pointer to au64loop variable. she keeps track of where we're at, bestie πnidβ the node selector. passNUMA_NO_NODEif you want all the nodes, you greedy little thing πflagsβ how we pick blocks, based on memory attributes β¨type_aβ pointer to thememblock_typewe're taking the range from (the source, the origin, the it-girl) π«Άtype_bβ pointer to thememblock_typethat excludes memory from being taken (the bouncer at the door π )out_startβ ptr to aphys_addr_tfor the start address of the range. can beNULLπout_endβ ptr to aphys_addr_tfor the end address of the range. can beNULLtoo πout_nidβ ptr to anintfor the nid of the range. also can beNULL. so many optional outputs, honestly slay π
π DESCRIPTION π
so what does she actually do? she finds the next range from type_a that is not marked as unsuitable in type_b. that's the whole job. that's the assignment. she ate and left no crumbs π₯
and the plot twist: she's the reverse of __next_mem_range. yeah. the backwards one. the remix. β
π§ SEE ALSO π§
go drink some water and then go read these, i'm serious:
- Kernel file
./mm/memblock.c,memblock overview(9) __memblock_find_range_bottom_up(9)__memblock_find_range_top_down(9)memblock_find_in_range_node(9)memblock_find_in_range(9)memblock_discard(9)memblock_double_array(9)memblock_merge_regions(9)memblock_insert_region(9)memblock_add_range(9)memblock_add_node(9)memblock_add(9)memblock_validate_numa_coverage(9)memblock_isolate_range(9)memblock_free(9)memblock_phys_free(9)memblock_setclr_flag(9)memblock_mark_hotplug(9)memblock_clear_hotplug(9)memblock_mark_mirror(9)memblock_mark_nomap(9)memblock_clear_nomap(9)memblock_reserved_mark_noinit(9)memblock_reserved_mark_kern(9)memblock_mark_kho_scratch(9)memblock_clear_kho_scratch(9)__next_mem_range(9)memblock_set_node(9)memblock_alloc_range_nid(9)memblock_phys_alloc_range(9)memblock_phys_alloc_try_nid(9)memblock_alloc_internal(9)memblock_alloc_exact_nid_raw(9)memblock_alloc_try_nid_raw(9)memblock_alloc_hugetlb(9)memblock_alloc_try_nid(9)__memblock_alloc_or_panic(9)memblock_estimated_nr_free_pages(9)memblock_is_region_memory(9)memblock_is_region_reserved(9)memblock_free_all(9)reserve_mem_find_by_name(9)reserve_mem_release_by_name(9)
and that's the page!! π she's from ./mm, dated October 2026, and she lives in the Kernel API Manual forever and ever. bye bestie, ily, go iterate some ranges (in reverse) πβ¨π¦
π¦ 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