Re: [PATCH v2 4/4] mm: Apply vm_uffd_ops API to core mm

Peter Xu
2025-07-02T20:38:13Z

On Sun, Jun 29, 2025 at 11:55:27AM +0300, Mike Rapoport wrote:
> On Fri, Jun 27, 2025 at 11:46:55AM -0400, Peter Xu wrote:
> > This patch completely moves the old userfaultfd core to use the new
> > vm_uffd_ops API. After this change, existing file systems will start to
> > use the new API for userfault operations.
>
> Maybe:
>
> Move userfaultfd core to use new vm_uffd_ops API. After this change file
> systems that implement vm_operations_struct can start using new API for
> userfaultfd operations.

Sure.

>
> > When at it, moving vma_can_userfault() into mm/userfaultfd.c instead,
> > because it's getting too big. It's only used in slow paths so it shouldn't
> > be an issue. Move the pte marker check before wp_async, which might be
> > more intuitive because wp_async depends on pte markers. That shouldn't
> > cause any functional change though because only one check would take effect
> > depending on whether pte marker was selected in config.
> >
> > This will also remove quite some hard-coded checks for either shmem or
> > hugetlbfs. Now all the old checks should still work but with vm_uffd_ops.
> >
> > Note that anonymous memory will still need to be processed separately
> > because it doesn't have vm_ops at all.
> >
> > Reviewed-by: James Houghton <jthoughton@google.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

I'll take this for now, thanks. We can finish the discussion in patch 1 to
see whether we need to refine the API.

--
Peter Xu