clear_full_ptes(9)
π clear_full_ptes(9) β the Kernel API Manual page you actually wanna read π
okay bestie, welcome to the <pink>kernel API manual</pink>, this one's about clear_full_ptes and honestly it's giving "small function, big responsibilities" energy β¨
πΈ NAME πΈ
clear_full_ptes β clears the present PTEs that map consecutive pages of the same folio π like, bye-bye mappings, but make it orderly.
β¨ SYNOPSIS β¨
void clear_full_ptes (struct mm_struct *mm , unsigned long addr , pte_t
*ptep , unsigned int nr , int full );
no cap, that's the whole signature, copy it exactly bestie π«Ά
π¦ ARGUMENTS π¦
mmβ the address space these pages are mapped into. it's the whole vibe container ngl πaddrβ the address where the first page is mapped. first entry, main character energy πptepβ page table pointer for that first entry. your starting point, periodt πnrβ how many entries we're clearing. yes, it's a plural situation πfullβ whether we're clearing a full mm. like, the whole entire mm π
π DESCRIPTION π
so the tea is: this function may be overridden by the architecture π β if your arch has opinions, it gets to do its own thing. otherwise it's implemented as a simple loop over ptep_get_and_clear_full. simple loop, iconic behaviour, that's the whole deal β¨
and lowkey important: the PTE bits in the PTE range besides the PFN can differ. for example, some PTEs might be write-protected. so don't go assuming they're all identical twins, because they are NOT π
π CONTEXT π
a few things that are straight up required, not optional, fr fr:
- The caller holds the page table lock π (yes, the page table lock, don't even think about skipping it)
- The PTEs map consecutive pages that belong to the same folio π§
- The PTEs are all in the same PMD β
bestie if any of those three aren't true, that's not a vibe check you wanna fail π
π SEE ALSO π
the whole friend group, in order, no one left out π«Ά
- Kernel file
./include/linux/pgtable.h 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_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)modify_prot_commit_ptes(9)pfnmap_setup_cachemode(9)pfnmap_track(9)pfnmap_untrack(9)pfnmap_setup_cachemode_pfn(9)
and that's the page bestie!! π
this lil beauty lives in ./include/linux and the version we're looking at is dated October 2026 β screenshot it, cite it, love it, iykyk πΈπ¦π
π¦ 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