sashiko.dev --
https://sashiko.dev/#/patchset/[email protected] -- wrote:
> commit 6d6b8f986b2959f8ae0932deccc5afa4ec485813
> Author: Kiryl Shutsemau (Meta) <[email protected]>
> Subject: mm/pagemap: add PAGE_IS_ACCESSED for RWP tracking
[ ... ]
> Does this new PAGE_IS_ACCESSED tracking correctly support the atomic
> read-and-reset workflow (PM_SCAN_WP_MATCHING) for RWP VMAs?
[ ... ]
> Since WP and RWP are mutually exclusive per VMA, userfaultfd_wp_async() and
> userfaultfd_wp_use_markers() will return false for RWP VMAs, causing
> pagemap_scan_test_walk() to return 1 and skip the VMA.
[ ... ]
> Because these loops hardcode a check against PAGE_IS_WRITTEN, and RWP VMAs
> now populate PAGE_IS_ACCESSED instead, this check will always evaluate to
> true for RWP. As a result, it looks like make_uffd_wp_pte() and
> make_uffd_wp_pmd() will be silently skipped, preventing the atomic
> reset of the tracking bits.
> Would it make sense to update both the wp_allowed check and the hardcoded
> PAGE_IS_WRITTEN checks to accommodate PAGE_IS_ACCESSED for RWP VMAs?
PM_SCAN_WP_MATCHING is the atomic read-and-reset flavour and is
implemented for the WP marker only.
The silent-skip on PM_SCAN_WP_MATCHING + RWP VMA is not intended
Will fold this fixup
if (userfaultfd_rwp(vma) && (p->arg.flags & PM_SCAN_WP_MATCHING))
return -EINVAL;
We can add similar operation for RWP later if there's a use-case.
--
Kiryl Shutsemau / Kirill A. Shutemov