__vmalloc_node_range(9)
β¨ __vmalloc_node_range β NAME β¨
okay so bestie, this page lives in the Kernel API Manual, section 9, and it's literally about allocating virtually contiguous memory π that's the whole vibe. one function, nine arguments, zero chill.
πΈ SYNOPSIS πΈ
void * __vmalloc_node_range (unsigned long size , unsigned long align ,
unsigned long start , unsigned long end , gfp_t gfp_mask , pgprot_t prot
, unsigned long vm_flags , int node , const void *caller );
bestie look at this signature. look at it. nine params. it's giving "i have a lot going on but i'm handling it" π
π ARGUMENTS π
okay so literally every single one, in order, no skipping, i don't make the rules (i do, but whatever):
sizeβ how big the allocation is. the whole point, honestly.alignβ the alignment you want. desired. aspirational β¨startβ where the vm area range starts.endβ where the vm area range ends. bookends, yk?gfp_maskβ the flags for the page level allocator. this one's the main character.protβ protection mask for the pages you're allocating. it's their armor π‘οΈvm_flagsβ extra vm area flags, like e.g.VM_NO_GUARD. little extras, and we love that.nodeβ which node to use for allocation, orNUMA_NO_NODE. no pressure, pick one π«Άcallerβ the caller's return address. like a little "who did this" tag.
π¦ DESCRIPTION π¦
so here's the tea: it allocates enough pages to cover size from the page level allocator, using the gfp_mask flags, and then maps them into a contiguous virtual range with protection prot. boom. that's the whole thing. slay. π
π supported GFP classes (yes, the list is real, memorize her)
GFP_KERNELGFP_ATOMICGFP_NOWAIT__GFP_RETRY_MAYFAIL__GFP_NORETRYGFP_NOFSGFP_NOIO
zone modifiers are not supported. no cap, don't try it. π
and heads up, bestie:GFP_ATOMICandGFP_NOWAITare supported only by__vmalloc. like, specifically her. don't get it twisted.
π₯ retry modifiers, and this part is kinda finicky
- only
__GFP_NOFAILis fully supported. queen. no notes. π __GFP_NORETRYand__GFP_RETRY_MAYFAILare supported with limitation β meaning the page tables are allocated with NOWAIT semantic, so they might fail under moderate memory pressure. it's giving "she's trying her best but the conditions are rough" π
π the other little flag besties
__GFP_NOWARNβ use it to suppress failure messages. for when you simply do not wish to hear about it, honestly relatable.__GFP_SKIP_KASANβ use it to skip unpoisoning of mapped pages (this applies whenprot=PAGE_KERNEL). very specific, very niche, very her.
β οΈ real talk: this can not be called from interrupt nor NMI contexts. like, at all. do not attempt. it will not go well and i will not be held responsible π
β RETURN β
the address of the area β or NULL on failure. that's it. either you got the address or you got nothing and you have to deal with that π«
π§ SEE ALSO π§
okay this list is LONG, but i would never skip a single one of them because they're all icons in their own right. and it lives in the kernel file ./mm/vmalloc.c, which is basically the group chat these all hang out in. iykyk:
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(9), vmalloc(9), vmalloc_huge_node(9), vzalloc(9), vmalloc_user(9), vmalloc_node(9), vzalloc_node(9), vrealloc_node_align(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. thirty-plus entries. she's connected. networking queen π
<div align="center">π</div>
okay that's the whole page!! mwah π«Ά it comes from the source ./mm, dated October 2026 β so jot that down, timestamp your receipts, and go allocate something virtually contiguous. periodt. π
β¨π
π¦ 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