memblock_insert_region(9)
π memblock_insert_region(9) β insert new memblock region π
okay bestie, so this is a page straight out of the Kernel API Manual β¨ and it's giving "small function, big responsibility" energy. Meet memblock_insert_region, the little void that slides a brand new region into the memblock table. No cap. π«Ά
β¨ SYNOPSIS β¨
void __init_memblock memblock_insert_region (struct memblock_type *type
, int idx , phys_addr_t base , phys_addr_t size , int nid , enum
memblock_flags flags );
literally five args and a return type of void, she doesn't even give you a status code back π you just gotta trust her.
π ARGUMENTS π
typeβ the memblock type you're inserting into. this is your destination table, the main character πidxβ the index for the insertion point. i.e. where in the table she gets slotted in, bestie πbaseβ base address of the new region. the starting coordinate, the origin story βsizeβ size of the new region. how much address space she's claiming for herself π₯nidβ node id of the new region. which NUMA node she belongs to, iykyk πΈflagsβ flags of the new region. her whole personality basically, it's anenum memblock_flagsπ¦
π DESCRIPTION π
Insert new memblock region [base, base + size) into type at idx. yes the interval is half-open, so base is in and base + size is out, that's just how she rolls π
π¨ the one thing you cannot skip, fr fr: type must already have extra room to accommodate the new region. this function does not grow anything for you. she does not check. she does not expand the array. she just inserts. so if you show up with a full table, that's on you bestie π
like, she's an inserter, not a grower. memblock_double_array(9) is right there in SEE ALSO if you need more space β just saying π
π¦ SEE ALSO π¦
the whole memblock friend group, they all hang out in the kernel file ./mm/memblock.c plus the memblock overview(9):
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_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, bestie, you ate that π this one comes to you from ./mm and it's dated October 2026 β so yes, she's from the future, we stan a forward-thinking queen ππ mwah, go insert some regions responsibly π
β¨
π¦ 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