vm_map_ram(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ vm_map_ram β€” the kernel API manual, but make it make sense ✨

okay so bestie, you're in vm_map_ram(9) territory, aka the kernel API manual, and this one is literally about mapping pages linearly into kernel virtual address space (that's the vmalloc space, iykyk) πŸ’–


🌸 NAME 🌸

vm_map_ram β€” map pages linearly into kernel virtual address (vmalloc space)

like, it takes your pages and lines them up all nice and linear in vmalloc space. slay.


πŸŽ€ SYNOPSIS πŸŽ€

void * vm_map_ram (struct page **pages , unsigned int count , int node
);

that's the whole vibe right there β€” pointer in, pointer out, no cap ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • pages β€” an array of pointers to the pages you wanna map. yes, pointers to pages, it's giving pointer-to-pointer energy πŸ™ˆ
  • count β€” number of pages. just… how many. keep track bestie πŸ’…
  • node β€” prefer to allocate data structures on this node. it's a preference, not a promise, so don't come for it 🌸

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea β˜•

If you use this function for less than VMAP_MAX_ALLOC pages, it could be faster than vmap so it's good. literally free real estate, we love efficiency πŸ”₯

but bestie, listen β€” if you mix long-life and short-life objects with vm_map_ram, it could consume lots of address space through fragmentation (especially on a 32bit machine). that's the messy part 😭 you could see failures in the end. like, actual failures. Please use this function for short-lived objects. short-lived only, periodt. πŸ‘‘

🌈 RETURN 🌈

a pointer to the address that has been mapped, or NULL on failure πŸ’€

so like, check it. always check it. if it's NULL, that's your vibe check failing fr fr.


⭐ SEE ALSO ⭐

Kernel file ./mm/vmalloc.c β€” and honestly the whole friend group showed up, we're obsessed:

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_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), 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, the whole vmalloc cinematic universe 🫢


and that's the page, bestie! this one came from the ./mm source, dated October 2026, and it's filed under vm_map_ram(9) β€” go forth and map responsibly, short-lived objects only, mwah πŸ’‹πŸ§š

πŸ“¦ where this page comes from