Re: [PATCH v2 11/14] userfaultfd: add UFFD_FEATURE_RWP_ASYNC for async fault resolution
From: Mike Rapoport
Date: Tue May 12 2026 - 14:37:40 EST
On Fri, May 08, 2026 at 04:55:23PM +0100, Kiryl Shutsemau (Meta) wrote:
> Sync RWP delivers a message and blocks the faulting thread until the
> handler resolves the fault. For working-set tracking the VMM does not
> need the message: it just needs to know, at scan time, which pages
> were touched. Async RWP serves that use case — the kernel restores
> access in-place and the faulting thread continues without blocking.
>
> The VMM reconstructs the access pattern after the fact via
> PAGEMAP_SCAN: pages whose uffd bit is still set (inverted
> PAGE_IS_ACCESSED) were not re-accessed since the last RWP cycle.
>
> Worth calling out: async resolution upgrades writable private anon
> PTEs via pte_mkwrite() when can_change_pte_writable() allows, mirroring
> do_numa_page(). Without it, every re-access of an RWP'd writable page
> would COW-fault a second time.
>
> UFFD_FEATURE_RWP_ASYNC requires UFFD_FEATURE_RWP.
>
> Signed-off-by: Kiryl Shutsemau <kas@xxxxxxxxxx>
> Assisted-by: Claude:claude-opus-4-6
Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> fs/userfaultfd.c | 19 ++++++++++++++++++-
> include/linux/userfaultfd_k.h | 6 ++++++
> include/uapi/linux/userfaultfd.h | 11 ++++++++++-
> mm/huge_memory.c | 25 ++++++++++++++++++++++++-
> mm/hugetlb.c | 32 +++++++++++++++++++++++++++++++-
> mm/memory.c | 27 +++++++++++++++++++++++++--
> 6 files changed, 114 insertions(+), 6 deletions(-)
--
Sincerely yours,
Mike.