kvrealloc_node_align(9)
π NAME π
This is kvrealloc_node_align(9), straight out of the Kernel API Manual, section 9 β reallocate memory; contents remain unchanged. Slay, but specifically: itβs the realloc bestie that keeps your bytes intact. β¨
πΈ SYNOPSIS πΈ
void * kvrealloc_node_align (const void *p , size_t size , unsigned long
align , gfp_t flags , int nid );
π ARGUMENTS π
pβ object to reallocate memory for. The main character pointer, bestie.sizeβ the size to reallocate.alignβ desired alignment.flagsβ the flags for the page level allocator.nidβ NUMA node id.
π¦ DESCRIPTION π¦
Okay so hereβs the tea, literally. If p is NULL, kvrealloc behaves exactly like kvmalloc. If size is 0 and p is not a NULL pointer, the object pointed to is freed. π
Only alignments up to those guaranteed by kmalloc will be honored. Please see Documentation/core-api/memory-allocation.rst for more details. No cap.
β οΈ If__GFP_ZEROlogic 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 is possible that__GFP_ZEROis not fully honored by this API. Thatβs the important part, bestie β donβt skip the flag. π
In any case, the contents of the object pointed to are preserved up to the lesser of the new and old sizes. So your data stays cute up to whichever size is smaller. π«Ά
π This function must not be called concurrently with itself or kvfree for the same memory allocation. Like, do not run up on it at the same time. Periodt.
π RETURN π
Pointer to the allocated memory or NULL in case of error. Thatβs it, thatβs the return. π
π SEE ALSO π
Kernel file ./include/linux/slab.h: SLAB_HWCACHE_ALIGN(9), SLAB_TYPESAFE_BY_RCU(9), SLAB_ACCOUNT(9), SLAB_RECLAIM_ACCOUNT(9), struct kmem_cache_args(9), kmem_cache_create_usercopy(9), kmem_cache_create(9), krealloc_node_align(9), kmem_cache_alloc(9), kmem_cache_charge(9), kmalloc(9), kmalloc_nolock(9), __alloc_objs(9), __alloc_flex(9), kmalloc_obj(9), kmalloc_objs(9), kmalloc_flex(9), kmalloc_array(9), krealloc_array(9), kcalloc(9), kzalloc(9), kvmalloc_node(9), kmalloc_size_roundup(9)
Cute little sign-off from the source/version stamp: this page lives under ./include/linux, dated October 2026, and itβs kvrealloc_node_align(9). Bye bestie, go preserve those bytes π
β¨
π¦ 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