clear_full_ptes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 🫢


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