memblock_alloc_try_nid_raw(9)
π memblock_alloc_try_nid_raw(9) π
okay so bestie, welcome to the Kernel API Manual β¨ β this one's a lil function called memblock_alloc_try_nid_raw, and no cap the name is a whole mouthful but it's literally gonna be your new fave. It's giving "allocate boot memory block" energy, except it does not zero the memory and it does not panic. periodt. π
πΈ SYNOPSIS πΈ
void * memblock_alloc_try_nid_raw (phys_addr_t size , phys_addr_t align
, phys_addr_t min_addr , phys_addr_t max_addr , int nid );
likeβ¦ yes, five arguments. she's high-maintenance but she slays π
π¦ ARGUMENTS π¦
sizeβ the size of the memory block you wanna allocate, in bytes. like how much memory you're asking for, fr fr.alignβ the alignment of the region and the block's size. both. she's thorough. β¨min_addrβ the lower bound of the memory region where you'd prefer the allocation to come from (phys address). lowkey the floor of the vibe check.max_addrβ the upper bound of the memory region where you'd prefer the allocation to come from (phys address) β OR you can passMEMBLOCK_ALLOC_ACCESSIBLEand it'll allocate only from memory limited by thememblock.current_limitvalue. iykyk πnidβ the nid of the free area to find. want any node? passNUMA_NO_NODE. easy. π«Ά
π§ DESCRIPTION π§
so this is a public function, and it provides additional debug information (including caller info) if enabled. cute, right? π
here's the part you gotta remember tho, bestie:
it does not zero the allocated memory, and it does not panic if the request cannot be satisfied. π
like, she's chill about it. no drama, no meltdown, no zeroing. you asked, she tried, that's the vibe.
π RETURN π
- on success β the virtual address of the allocated memory block π
- on failure β
NULLπ
that's it. that's the whole return situation.
π SEE ALSO π
buckle up bestie, this list is long β but every single one of these is iconic in her own way:
- 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)__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_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)
okay that's the whole page, you ate that π go forth and allocate responsibly, bestie π
β xoxo, from ./mm, October 2026, memblock_alloc_try_nid_raw(9) signing off πβ¨
π¦ 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