vrealloc_node_align(9)
π vrealloc_node_align(9) β like, the Kernel API Manual page, but make it make sense
okay bestie, gather round π«Ά this one lives in the Kernel API Manual and it's all about reallocating virtually contiguous memory while keeping your contents exactly where they were. no cap, the vibes are immaculate but the rules are strict. let's go π
β¨ NAME β¨
vrealloc_node_align β reallocate virtually contiguous memory; and the contents? they remain unchanged, periodt π
πΈ SYNOPSIS πΈ
void * vrealloc_node_align (const void *p , size_t size , unsigned long
align , gfp_t flags , int nid );
that's the whole signature, copy it exactly, don't be cute with it π
π¦ ARGUMENTS π¦
pβ the object you're reallocating memory for π₯Ίsizeβ the size you wanna reallocate toalignβ the alignment you're requesting, bestie, be reasonableflagsβ the flags for the page level allocator πnidβ the node number of the target node β
π₯ DESCRIPTION π₯
so here's the tea β
if p is NULL, vrealloc_XXX behaves exactly like vmalloc_XXX. literally identical energy, no notes. and if size is 0 and p is not a NULL pointer, the object pointed to gets freed. bye bye π
if the caller wants the new memory to be on a specific node only, the __GFP_THISNODE flag should be set. otherwise? the function will try to avoid reallocation and possibly disregard the specified nid π iykyk β set the flag or don't come crying to me.
now the __GFP_ZERO part, listen up π if __GFP_ZERO logic is requested, callers must ensure that, starting with the initial memory allocation, every subsequent call to this API for the same memory allocation is flagged with __GFP_ZERO. otherwise it's possible that __GFP_ZERO is not fully honored by this API. that's a big deal, fr fr π
π¨ and requesting an alignment that is bigger than the alignment of the existing allocation will fail. not "might", not "maybe" β it fails. respect the existing alignment or perish.
in any case, the contents of the object pointed to are preserved up to the lesser of the new and old sizes π (so like, the overlap, basically β the smaller of the two).
and the safety warning, because we care about you bestie:
β οΈ this function must not be called concurrently with itself or vfree for the same memory allocation. no race conditions, no chaotic main character energy. one at a time, please π«Ά
π RETURN π
- a pointer to the allocated memory π
NULLifsizeis zero, or in case of failure π
π SEE ALSO π
kernel file ./mm/vmalloc.c and the whole extended fam β every single one, no skipping:
vunmap_range(9), vmap_pages_range(9), vm_area_map_pages(9),
vm_area_unmap_pages(9), new_vmap_block(9), vm_unmap_aliases(9),
vm_unmap_ram(9), vm_map_ram(9), vm_area_add_early(9),
vm_area_register_early(9), get_vm_area(9), find_vm_area(9),
remove_vm_area(9), vfree_atomic(9), vfree(9), vunmap(9), vmap(9),
vmap_pfn(9), __vmalloc_node_range(9), __vmalloc_node(9), vmalloc(9),
vmalloc_huge_node(9), vzalloc(9), vmalloc_user(9), vmalloc_node(9),
vzalloc_node(9), vmalloc_32(9), vmalloc_32_user(9), vread_iter(9),
remap_vmalloc_range_partial(9), remap_vmalloc_range(9),
pvm_find_va_enclose_addr(9), pvm_determine_end_from_reverse(9),
pcpu_get_vm_areas(9), pcpu_free_vm_areas(9)
like, that's the whole group chat π
and that's the page!! π¦ this little gem comes to you from ./mm and it's dated October 2026 β mwah, slay, go forth and reallocate responsibly 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