memblock_merge_regions(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« memblock_merge_regions(9) πŸ’«

okay so welcome to the Kernel API Manual bestie, today's episode is genuinely so satisfying β€” we're talking about memblock_merge_regions, which is literally the "let me just tidy up in here" function of the memblock world ✨


🌸 NAME 🌸

memblock_merge_regions β€” merge neighboring compatible regions 🫢 (yes that's it, that's the whole vibe, she cleans up the friend groups so nobody's sitting alone at the lunch table)


πŸŽ€ SYNOPSIS πŸŽ€

void __init_memblock memblock_merge_regions (struct memblock_type *type
, unsigned long start_rgn , unsigned long end_rgn );

like, look at her. no return value, she just does it πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • type β€” the memblock type you want her to scan πŸ‘€ like, which pile are we tidying
  • start_rgn β€” start scanning from (start_rgn - 1) β€” yes bestie, minus one, that's not a typo, that's the actual spec πŸ™ˆ
  • end_rgn β€” end scanning at (end_rgn - 1). So basically: scan type and merge neighboring compatible regions in [start_rgn - 1, end_rgn) ⭐ note the square bracket on the left and the round bracket on the right, that's a half-open interval and she's not being vague about it
ngl the - 1 thing on both ends is doing a lot of work here. just... read it twice, screenshot it, whatever you need. it's start_rgn - 1 and end_rgn - 1. periodt πŸ’€

🌈 SEE ALSO 🌈

okay this list is long and honestly iconic for it, so buckle up bestie, we're going through the whole friend group 🧚

Kernel file ./mm/memblock.c πŸ“ β€” plus 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_insert_region(9) (her direct coworker fr fr), 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), __next_mem_range_rev(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 whole page!! no cap, she's short and sweet and she just merges the neighboring compatible regions and leaves πŸ’–

sign-off era: this gorgeous little page came from the source in ./mm πŸ“‚, and it's dated October 2026 πŸ—“οΈ β€” so yeah, future-dated queen behavior πŸ‘‘ bye bestie, go merge something πŸ¦‹βœ¨
πŸ“¦ where this page comes from