Kiryl Shutsemau (Meta)
c0ffe79eed
mm: rename uffd-wp PTE accessors to uffd
...
Userfaultfd RWP will reuse the uffd-wp PTE bit to mark access-tracking
PTEs, alongside the write-protected ones it already marks. The bit's
meaning now depends on the VMA flag (WP or RWP), not on its name.
Rename the kernel-internal names that describe the bit:
- pte/pmd/huge_pte accessors (and swap variants)
- pgtable_supports_uffd() capability query
- SCAN_PTE_UFFD khugepaged enum
The ftrace string emitted by mm_khugepaged_scan_pmd for this enum is
kept as "pte_uffd_wp" so existing trace-based tooling keeps matching.
Pure mechanical rename -- no behavior change.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Kiryl Shutsemau <[email protected] >
Assisted-by: Claude:claude-opus-4-6
Reviewed-by: Mike Rapoport (Microsoft) <[email protected] >
Reviewed-by: SeongJae Park <[email protected] >
Cc: Andrea Arcangeli <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: James Houghton <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: Liam Howlett <[email protected] >
Cc: Lorenzo Stoakes <[email protected] >
Cc: Paolo Bonzini <[email protected] >
Cc: Peter Xu <[email protected] >
Cc: Sean Christopherson <[email protected] >
Cc: Suren Baghdasaryan <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Zi Yan <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2026-08-04 19:18:36 -07:00
Chunyan Zhang
f59c0924d6
mm: userfaultfd: add pgtable_supports_uffd_wp()
...
Some platforms can customize the PTE/PMD entry uffd-wp bit making it
unavailable even if the architecture provides the resource. This patch
adds a macro API pgtable_supports_uffd_wp() that allows architectures to
define their specific implementations to check if the uffd-wp bit is
available on which device the kernel is running.
Also this patch is removing "ifdef CONFIG_HAVE_ARCH_USERFAULTFD_WP" and
"ifdef CONFIG_PTE_MARKER_UFFD_WP" in favor of pgtable_supports_uffd_wp()
and uffd_supports_wp_marker() checks respectively that default to
IS_ENABLED(CONFIG_HAVE_ARCH_USERFAULTFD_WP) and
"IS_ENABLED(CONFIG_HAVE_ARCH_USERFAULTFD_WP) &&
IS_ENABLED(CONFIG_PTE_MARKER_UFFD_WP)" if not overridden by the
architecture, no change in behavior is expected.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Chunyan Zhang <[email protected] >
Acked-by: David Hildenbrand <[email protected] >
Cc: Albert Ou <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Alexandre Ghiti <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Andrew Jones <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Axel Rasmussen <[email protected] >
Cc: Christian Brauner <[email protected] >
Cc: Conor Dooley <[email protected] >
Cc: Conor Dooley <[email protected] >
Cc: Deepak Gupta <[email protected] >
Cc: Jan Kara <[email protected] >
Cc: Liam Howlett <[email protected] >
Cc: Lorenzo Stoakes <[email protected] >
Cc: Michal Hocko <[email protected] >
Cc: Mike Rapoport <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Paul Walmsley <[email protected] >
Cc: Peter Xu <[email protected] >
Cc: Rob Herring <[email protected] >
Cc: Suren Baghdasaryan <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Yuanchu Xie <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2025-11-24 15:08:54 -08:00
Peter Xu
2e3d5dc508
userfaultfd: wp: add pmd_swp_*uffd_wp() helpers
...
Adding these missing helpers for uffd-wp operations with pmd
swap/migration entries.
Signed-off-by: Peter Xu <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Jerome Glisse <[email protected] >
Reviewed-by: Mike Rapoport <[email protected] >
Cc: Andrea Arcangeli <[email protected] >
Cc: Bobby Powers <[email protected] >
Cc: Brian Geffon <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: Denis Plotnikov <[email protected] >
Cc: "Dr . David Alan Gilbert" <[email protected] >
Cc: Hugh Dickins <[email protected] >
Cc: Johannes Weiner <[email protected] >
Cc: "Kirill A . Shutemov" <[email protected] >
Cc: Martin Cracauer <[email protected] >
Cc: Marty McFadden <[email protected] >
Cc: Maya Gokhale <[email protected] >
Cc: Mel Gorman <[email protected] >
Cc: Mike Kravetz <[email protected] >
Cc: Pavel Emelyanov <[email protected] >
Cc: Rik van Riel <[email protected] >
Cc: Shaohua Li <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-04-07 10:43:39 -07:00
Andrea Arcangeli
5a281062af
userfaultfd: wp: add WP pagetable tracking to x86
...
Accurate userfaultfd WP tracking is possible by tracking exactly which
virtual memory ranges were writeprotected by userland. We can't relay
only on the RW bit of the mapped pagetable because that information is
destroyed by fork() or KSM or swap. If we were to relay on that, we'd
need to stay on the safe side and generate false positive wp faults for
every swapped out page.
[[email protected] : append _PAGE_UFD_WP to _PAGE_CHG_MASK]
Signed-off-by: Andrea Arcangeli <[email protected] >
Signed-off-by: Peter Xu <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Jerome Glisse <[email protected] >
Reviewed-by: Mike Rapoport <[email protected] >
Cc: Bobby Powers <[email protected] >
Cc: Brian Geffon <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: Denis Plotnikov <[email protected] >
Cc: "Dr . David Alan Gilbert" <[email protected] >
Cc: Hugh Dickins <[email protected] >
Cc: Johannes Weiner <[email protected] >
Cc: "Kirill A . Shutemov" <[email protected] >
Cc: Martin Cracauer <[email protected] >
Cc: Marty McFadden <[email protected] >
Cc: Maya Gokhale <[email protected] >
Cc: Mel Gorman <[email protected] >
Cc: Mike Kravetz <[email protected] >
Cc: Pavel Emelyanov <[email protected] >
Cc: Rik van Riel <[email protected] >
Cc: Shaohua Li <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-04-07 10:43:39 -07:00