finish_mkwrite_fault(9)
π finish_mkwrite_fault β the kernel API manual, bestie edition β¨
okay so real talk, we're in the <pink>finish_mkwrite_fault(9)</pink> page of the Kernel API Manual and it's genuinely such a slay little function. let me put you on π«Ά
β¨ NAME β¨
finish_mkwrite_fault β it finishes the page fault for a shared mapping, and it makes the PTE writeable once the page is all prepared. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
vm_fault_t finish_mkwrite_fault (struct vm_fault *vmf , struct folio
*folio );
like yes, two args, returns a vm_fault_t, iconic behavior honestly β¨
π ARGUMENTS π
vmfβ the structure that describes the fault π like, it's the context bestie, it knows what's going onfolioβ the folio ofvmf->pageπΈ literally just that, the folio belonging to that page
π¦ DESCRIPTION π¦
so here's the tea β β this function handles all that is needed to finish a write page fault in a shared mapping, and the reason it even exists is that the PTE is read-only once the mapped page is prepared π. so somebody's gotta come in and deal with it. it handles the locking of the PTE and the modifying of it β both, no cap, it's doing the most and we respect it π
and like, heads up bestie: the function expects the page to be locked, or expects some other protection against concurrent faults / writeback (think DAX radix tree locks). so don't come in here unlocked, that's not the vibe π
π₯ RETURN π₯
0on success β¨ we love a clean winVM_FAULT_NOPAGEwhen the PTE got changed before we acquired the PTE lock π yeah, someone sniped it, it happens, not our fault
π SEE ALSO π
Kernel file ./mm/memory.c β and the whole friend group came through, fr fr:
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), 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)
and that's the page bestie π§ this lil source is hanging out in ./mm, it's dated October 2026, and it's <rainbow>finish_mkwrite_fault(9)</rainbow> β go forth and finish those faults, ily, 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