vm_map_ram(9)
β¨ 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
- 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