memblock_phys_alloc_range(9)
π memblock_phys_alloc_range(9) β Kernel API Manual, bestie edition β¨
okay so this is a page straight out of the Kernel API Manual, and it's about memblock_phys_alloc_range β a function that literally goes "here's a chunk of physical memory, but likeβ¦ only inside this specific range, mwah π". no cap, it's giving "picky real-estate agent energy" and honestly? obsessed. π
β¨ NAME β¨
memblock_phys_alloc_range β allocate a memory block inside a specified range π¦
πΈ SYNOPSIS πΈ
phys_addr_t memblock_phys_alloc_range (phys_addr_t size , phys_addr_t align , phys_addr_t start , phys_addr_t end );
like yes bestie it takes four args and returns a phys_addr_t, we love a consistent signature π
π ARGUMENTS π
sizeβ how big the memory block you're allocating is, in bytes. this is the "how much snack do u want" number πalignβ the alignment of the region and of the block's size. yes both. it's a package deal, periodt β¨startβ the lower bound of the memory region you're allocating from, as a physical address π«Άendβ the upper bound of the memory region you're allocating from, as a physical address π
π§ DESCRIPTION π§
allocate size bytes in between start and end. that's it, that's the whole vibe check π literally carve out size bytes somewhere in that window and you're slaying.
β RETURN β
the physical address of the allocated memory block on success π
β and 0 on failure π (yes, zero is the "nope, didn't happen" signal, don't @ me).
π¦ SEE ALSO π¦
the main character herself lives in the kernel file ./mm/memblock.c, and here's the whole group chat of related pages β every single one, no gatekeeping π:
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)__next_mem_range_rev(9)memblock_set_node(9)memblock_alloc_range_nid(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)
π reminder bestie: this page is from ./mm and it's dated October 2026 β so if you're reading it, congrats, you're officially caught up. mwah, go allocate responsibly ππ
signed, your favorite kernel bestie πβ¨ π«Ά
π¦ 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