modify_prot_commit_ptes(9)
π modify_prot_commit_ptes β the modify_prot_commit_ptes(9) glow-up π
okay so bestie, this is a page from the Kernel API Manual, and it's literally about committing a pte update to a whole batch of ptes while leaving any hardware-controlled bits in the PTE untouched π (yes, untouched β the hardware keeps its toys, we don't touch them, periodt).
β¨ SYNOPSIS β¨
void modify_prot_commit_ptes (struct vm_area_struct *vma , unsigned long
addr , pte_t *ptep , pte_t old_pte , pte_t pte , unsigned int nr );
like, that's the whole signature, no cap π«Ά
πΈ ARGUMENTS πΈ
vmaβ the virtual memory area these pages are mapped into. it's giving "where do these pages even live" energy.addrβ the address the first page is mapped at. first page gets the honors πptepβ page table pointer for the first entry. your starting point, iykyk.old_pteβ the old page table entry (for the first entry) which is now cleared. it's had its moment, now it's gone πpteβ the new page table entry to be set. the main character, fr fr.nrβ number of entries. how many ptes are we doing this to, bestie.
π¦ DESCRIPTION π¦
May be overridden by the architecture β so some arches are out here doing their own thing π§. Otherwise, it's implemented as a simple loop over ptep_modify_prot_commit. simple loop, simple life, lowkey iconic.
π₯ CONTEXT π₯
okay so the important stuff, listen up:
The caller holds the page table lock π. The PTEs are all in the same PMD. On exit, the set ptes in the batch map the same folio.
and here's the part you cannot miss: the ptes set by ptep_modify_prot_start may additionally have young and/or dirty bits set where previously they were not, so the updated ptes may have these additional changes β¨. not me warning you about extra bits showing up uninvited π
π SEE ALSO π
Kernel file ./include/linux/pgtable.h and its whole friend group:
lazy_mmu_mode_enable(9)lazy_mmu_mode_disable(9)__task_lazy_mmu_mode_pause(9)lazy_mmu_mode_pause(9)__task_lazy_mmu_mode_resume(9)lazy_mmu_mode_resume(9)pte_batch_hint(9)set_ptes(9)clear_young_dirty_ptes(9)get_and_clear_full_ptes(9)get_and_clear_ptes(9)clear_full_ptes(9)clear_ptes(9)clear_nonpresent_ptes(9)ptep_try_set(9)flush_tlb_before_set(9)wrprotect_ptes(9)clear_flush_young_ptes(9)test_and_clear_young_ptes(9)modify_prot_start_ptes(9)pfnmap_setup_cachemode(9)pfnmap_track(9)pfnmap_untrack(9)pfnmap_setup_cachemode_pfn(9)
bestie reminder: the commit is the second half of the party β modify_prot_start_ptes(9) is the pregame, this one's the drop π₯
omg okay that's the whole thing, you ate that π this lil gem lives in ./include/linux and the manual says October 2026 β so like, future icons only πβ¨ slay, go commit some ptes, 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