linux/Documentation/admin-guide/mm
Kiryl Shutsemau (Meta) 3389648819 mm/pagemap: add PAGE_IS_ACCESSED for RWP tracking
PAGEMAP_SCAN already reports PAGE_IS_WRITTEN from the inverted uffd PTE
bit, targeting the UFFDIO_WRITEPROTECT workflow.  UFFDIO_RWPROTECT reuses
the same PTE bit as a marker for read-write protection, but "has been
written" and "has been accessed" are distinct semantic signals — they
happen to share one PTE bit today only because the two implementations
share infrastructure.

Give RWP its own pagemap category so the UAPI does not conflate them:

  PAGE_IS_WRITTEN   reported on VM_UFFD_WP VMAs,  !pte_uffd(pte)
  PAGE_IS_ACCESSED  reported on VM_UFFD_RWP VMAs, !pte_uffd(pte)

Both still read the same PTE bit today, but each is scoped to the VMA
whose registered mode makes the bit meaningful.  If a future
implementation moves RWP to a separate PTE bit, only PAGE_IS_ACCESSED
switches over.

This is a UAPI narrowing.  Outside VM_UFFD_WP VMAs the uffd bit is always
clear, so PAGEMAP_SCAN used to flag PAGE_IS_WRITTEN on every present PTE
there — a meaningless duplicate of PAGE_IS_PRESENT.  Now PAGE_IS_WRITTEN
fires only inside VM_UFFD_WP VMAs.

pagemap_hugetlb_category() now takes the vma like its PTE/PMD peers.

Link: https://lore.kernel.org/20260708111417.173443-12-kirill@shutemov.name
Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
Assisted-by: Claude:claude-opus-4-6
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: James Houghton <jthoughton@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-08-04 19:18:38 -07:00
..
damon Docs/{admin-guide,mm}/damon: fix DAMON documentation details 2026-07-30 19:40:22 -07:00
cma_debugfs.rst mm, cma: support multiple contiguous ranges, if requested 2025-03-16 22:06:25 -07:00
concepts.rst docs/admin-guide/mm: remove useless markup 2023-02-02 10:18:05 -07:00
hugetlbpage.rst selftests/mm: rename hugepage-* tests to hugetlb-* 2026-06-21 11:37:19 -07:00
idle_page_tracking.rst - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
index.rst mm/swap: do not choose swap device according to numa node 2025-11-16 17:28:27 -08:00
kho.rst kho: document kexec-metadata tracking feature 2026-04-18 00:10:49 -07:00
ksm.rst Docs: typos/spelling 2024-05-02 10:02:29 -06:00
memory-hotplug.rst mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION 2026-01-31 14:22:36 -08:00
multigen_lru.rst mm: add max swappiness arg to lru_gen for anonymous memory only 2025-05-12 23:50:36 -07:00
nommu-mmap.rst docs: fix 're-use' -> 'reuse' in documentation 2026-02-02 09:54:15 -07:00
numa_memory_policy.rst docs: mm: fix typo in numa_memory_policy.rst 2026-04-05 13:53:23 -07:00
numaperf.rst - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
pagemap.rst mm/pagemap: add PAGE_IS_ACCESSED for RWP tracking 2026-08-04 19:18:38 -07:00
shrinker_debugfs.rst docs/admin-guide/mm: remove useless markup 2023-02-02 10:18:05 -07:00
slab.rst doc: Move SLUB documentation to the admin guide 2025-06-18 13:06:26 +02:00
soft-dirty.rst docs/admin-guide/mm: remove useless markup 2023-02-02 10:18:05 -07:00
transhuge.rst mm: move __alloc_pages() to mm/page_alloc.h 2026-07-30 19:40:43 -07:00
userfaultfd.rst userfaultfd: add UFFDIO_REGISTER_MODE_RWP and UFFDIO_RWPROTECT plumbing 2026-08-04 19:18:38 -07:00
zswap.rst Docs/admin-guide/mm/zswap: s/red-black tree/xarray/ 2025-11-16 17:27:57 -08:00