vm_map_pages_zero(9)
π vm_map_pages_zero(9) π
okay so this is a page from the Kernel API Manual, section 9, bestie β it's all about vm_map_pages_zero, and yes the name is a whole mouthful but we move π«Ά
β¨ NAME β¨
vm_map_pages_zero β maps a range of kernel pages, and it starts at a zero offset πΈ
π¦ SYNOPSIS π¦
int vm_map_pages_zero (struct vm_area_struct *vma , struct page **pages
, unsigned long num );
π ARGUMENTS π
vmaβ the uservmayou're mapping into, like this is the destination vibe πpagesβ a pointer to the array of source kernel pages, aka where the actual pages live πnumβ how many pages are in that page array, count 'em π₯
π DESCRIPTION π
So it's basically vm_map_pages, except it explicitly sets the offset to 0. That's the whole twist, no cap π
This function is intended for the drivers that did not consider vm_pgoff β like, they just never thought about it, and now this function has their back π
β CONTEXT β
Process context, bestie. It gets called by mmap handlers. That's the vibe check π§
π« RETURN π«
0 on success, and an error code otherwise. Slay when it's zero, weep when it's not π
π₯ SEE ALSO π₯
Kernel file ./mm/memory.c β and the whole friend group is here, look at them all:
free_pgd_range(9)free_pgtables(9)__vm_normal_page(9)vm_normal_page(9)vm_normal_folio(9)vm_normal_page_pmd(9)vm_normal_folio_pmd(9)vm_normal_page_pud(9)restore_exclusive_pte(9)cond_install_uffd_wp_ptes(9)zap_vma_for_reaping(9)unmap_vmas(9)zap_vma_range_batched(9)zap_vma_range(9)zap_special_vma_range(9)vm_insert_pages(9)vm_insert_page(9)vm_map_pages(9)vmf_insert_pfn_prot(9)vmf_insert_pfn(9)remap_pfn_range(9)vm_iomap_memory(9)__vmf_anon_prepare(9)finish_mkwrite_fault(9)unmap_mapping_folio(9)unmap_mapping_pages(9)unmap_mapping_range(9)set_pte_range(9)finish_fault(9)mm_account_fault(9)follow_pfnmap_start(9)follow_pfnmap_end(9)generic_access_phys(9)access_remote_vm(9)copy_remote_vm_str(9)folio_zero_user(9)
ngl bestie, the "zero" in the name is doing exactly what it says on the tin β offset 0, periodt π
mwah, that's the page! π this lil beauty lives in ./mm and it's dated October 2026 β go off, kernel docs, you ate πβ¨
π¦ 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