pfn_mkclean_range(9)
π pfn_mkclean_range(9) β the Kernel API Manual, bestie edition π
okay so real talk, this one lives in the Kernel API Manual and she's a little technical queen, but we're gonna get through it together, i promise π«Ά
β¨ NAME β¨
pfn_mkclean_range β she cleans the PTEs (and yes, the PMDs too, don't forget the PMDs π) that are mapped across the range of [@pfn, @pfn + @nr_pages) at the specific offset (@pgoff) inside the @vma of shared mappings. and because clean PTEs have to be readonly too (it's giving "obviously"), she write-protects them as well. two jobs, one function, main character energy π
πΈ SYNOPSIS πΈ
int pfn_mkclean_range (unsigned long pfn , unsigned long nr_pages ,
pgoff_t pgoff , struct vm_area_struct *vma );
π¦ ARGUMENTS π¦
pfnβ the start pfn. that's the beginning, the origin story, where it all kicks off β¨nr_pagesβ how many physically contiguous pages we're dealing with, starting withpfn. like a little squad of pages, all lined up π«Άpgoffβ the page offset that thepfnis mapped with. the exact spot, iykyk πvmaβ the vma thatpfnis mapped within. her home, her turf, her whole vibe π‘
π DESCRIPTION π
returns the number of cleaned PTEs (including PMDs). that's it, that's the whole deal β she does the work, she reports back how many she did, no cap π₯
π SEE ALSO π
the kernel file ./mm/rmap.c and honestly her entire friend group, because these functions literally all hang out together:
__anon_vma_prepare(9)anon_vma_clone(9)unlink_anon_vmas(9)page_address_in_vma(9)folio_referenced(9)mapping_wrprotect_range(9)folio_move_anon_rmap(9)__folio_set_anon(9)__page_check_anon_rmap(9)folio_add_anon_rmap_ptes(9)folio_add_anon_rmap_pmd(9)folio_add_new_anon_rmap(9)folio_add_file_rmap_ptes(9)folio_add_file_rmap_pmd(9)folio_add_file_rmap_pud(9)folio_remove_rmap_ptes(9)folio_remove_rmap_pmd(9)folio_remove_rmap_pud(9)try_to_unmap(9)try_to_migrate(9)make_device_exclusive(9)__rmap_walk_file(9)
like, the whole rmap.c group chat. genuinely iconic of them π
heads up bestie: this page is sourced from ./mm and her version stamp says October 2026 β so she's fresh, she's current, she's that girl π§ββοΈβ
anyway ily, go clean those PTEs, and remember: write protect = protect your energy π π
π¦ 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