get_and_clear_full_ptes(9)
π get_and_clear_full_ptes(9) β from the Kernel API Manual, bestie
okay so picture this: you're deep in the kernel, you've got a whole run of PTEs pointing at consecutive pages of the same folio, and you need them GONE but you also need to pocket the dirty/accessed bits on the way out. that's this function. she's giving cleanup crew with a clipboard. π§Ήβ¨
β¨ SYNOPSIS β¨
pte_t get_and_clear_full_ptes (struct mm_struct *mm , unsigned long addr
, pte_t *ptep , unsigned int nr , int full );
like, it returns a pte_t. don't ask questions, just accept the gift. π
π«Ά ARGUMENTS π«Ά
mmβ the address space these pages are living in. her whole world, basically.addrβ the address where the first page is mapped. everything else lines up after her.ptepβ the page table pointer for that first entry. your starting point, your main character pointer. πnrβ how many entries we're clearing. the headcount.fullβ whether we're clearing a full mm or not. yes/no energy, but please pass the actual value it expects, not my vibes.
π DESCRIPTION π
so, architectures are allowed to override this one β it's a "may be overridden" situation, lowkey iconic of her. but if nobody overrides it, the default implementation is literally just a simple loop over ptep_get_and_clear_full, merging those dirty/accessed bits into the returned PTE. that's it. that's the whole thing. no cap.
β οΈ heads up bestie: the PTE bits in the PTE range besides the PFN can absolutely differ between entries. for example, some PTEs might be write-protected. so don't go assuming the whole range is uniform β she's not. π
πΈ CONTEXT πΈ
the rules of the group chat, fr fr:
- the caller holds the page table lock. no lock, no entry. π
- the PTEs map consecutive pages that belong to the same folio.
- the PTEs are all in the same PMD. all of them. every single one.
π¦ SEE ALSO π¦
the whole extended friend group, in order, no one left out because we do NOT do that here:
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_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), modify_prot_commit_ptes(9), pfnmap_setup_cachemode(9), pfnmap_track(9), pfnmap_untrack(9), pfnmap_setup_cachemode_pfn(9)
aight that's the page! π this one lives over in ./include/linux and she's stamped October 2026 β go off, calendar. mwah, stay hydrated, and remember to hold the page table lock. ππ
π¦ 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