__vmalloc_node_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ __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, or NUMA_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_KERNEL
  • GFP_ATOMIC
  • GFP_NOWAIT
  • __GFP_RETRY_MAYFAIL
  • __GFP_NORETRY
  • GFP_NOFS
  • GFP_NOIO

zone modifiers are not supported. no cap, don't try it. πŸ™ˆ

and heads up, bestie: GFP_ATOMIC and GFP_NOWAIT are supported only by __vmalloc. like, specifically her. don't get it twisted.

πŸ”₯ retry modifiers, and this part is kinda finicky

  • only __GFP_NOFAIL is fully supported. queen. no notes. πŸ‘‘
  • __GFP_NORETRY and __GFP_RETRY_MAYFAIL are 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 when prot=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