finish_fault(9)
π finish_fault(9) β like, the Kernel API Manual page you actually wanna read β¨
okay so this is finish_fault(9) from the Kernel API Manual, and bestie, it's literally the "last mile" of a page fault π
πΈ NAME πΈ
finish_fault β the function that finishes the page fault once we've already prepared the page we're faulting in. slay, closure π
β¨ SYNOPSIS β¨
vm_fault_t finish_fault (struct vm_fault *vmf );
π«Ά ARGUMENTS π«Ά
vmfβ the structure that describes the fault. it's giving "everything you need to know about what just went down" π
π₯ DESCRIPTION π₯
so here's the vibe π: this function handles all the stuff that's needed to wrap up a page fault once the page to fault in is already prepared. it does not prepare the page β that part's already done β it just brings it home π β¨
what it actually handles, no cap:
- locking of PTEs π
- inserting the PTE for the given page π
- adding reverse page mapping π
- handling memcg charges πΈ
- LRU addition π
important caveat, fr fr: the function expects the page to be locked going in, and on success it consumes a reference of a page being mapped β that's for the PTE which maps it. don't come for it later expecting that ref back, it's gone π
β RETURN β
0on success π- a
VM_FAULT_code in case of error π
π SEE ALSO π
all the friends in the kernel file ./mm/memory.c β go say hi to the whole group chat π§:
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)vm_map_pages_zero(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)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)
and that's the whole page, babe π«Ά that's it, that's the fault π
β this came to you from ./mm, dated October 2026, in the Kernel API Manual. mwah, go finish some faults πβ¨π
π¦ 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