vmap_pages_range(9)
π vmap_pages_range(9) β from the Kernel API Manual, bestie π
okay so you're in the vmap_pages_range section of the Kernel API Manual and honestly? this one is a little baddie. it maps pages into a kernel virtual address. that's it, that's the whole personality. let's get into it π«Ά
β¨ NAME β¨
vmap_pages_range β map pages to a kernel virtual address
like literally, it puts your pages somewhere in kernel virtual address space. iconic behaviour, no notes π
πΈ SYNOPSIS πΈ
int vmap_pages_range (unsigned long addr , unsigned long end , pgprot_t
prot , struct page **pages , unsigned int page_shift );
she returns an int, she takes five arguments, she does not elaborate further. main character energy fr fr β
π ARGUMENTS π
okay so the five things you're handing her:
addrβ start of the VM area to map π where the mapping begins, bestie.endβ end of the VM area to map, and heads up, it's non-inclusive, so like, don't expectenditself to be in on the party πprotβ page protection flags to use. the whole vibe of the mapping, permission-wise π¦pagesβ the pages to map, and note that these are alwaysPAGE_SIZEpages. always. no cap π₯page_shiftβ the maximum shift the pages may be mapped with, and ngl this one has a whole situation attached: the pages must be aligned and contiguous up to at least this shift β οΈ that's not a suggestion, that's the requirement.
π RETURN π
0on success β-errnoon failure π
that's the whole return situation. slay, consistent, predictable.
π SEE ALSO π
bestie there are so many friends in this orbit, buckle up π§ β Kernel file ./mm/vmalloc.c, plus:
vunmap_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_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)
π bestie reminder:page_shiftis not decorative β your pages need to be aligned and contiguous up to at least that shift. do not come for her with a raggedy page array, she will simply return-errno. π«Ά
and that's the page!! brought to you by ./mm, the October 2026 edition of the Kernel API Manual, filed under vmap_pages_range(9) β mwah, go map some pages, you absolute legend π
β¨π
π¦ 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