On Mon, Mar 30, 2026 at 05:58:29PM +0100, Matthew Wilcox wrote:
> On Mon, Mar 30, 2026 at 01:11:08PM +0300, Mike Rapoport wrote:
> > First, there is no fundamental reason to limit userfaultfd support only to
> > the core memory types and userfaults can be handled similarly to regular
> > page faults provided a VMA owner implements appropriate callbacks.
> > 
> > Second, historically various code paths were conditioned on
> > vma_is_anonymous(), vma_is_shmem() and is_vm_hugetlb_page() and some of
> > these conditions can be expressed as operations implemented by a
> > particular memory type.
> > 
> > Introduce vm_uffd_ops extension to vm_operations_struct that will delegate
> > memory type specific operations to a VMA owner.
> 
> But the VMA owner already gets control of the page fault.  We don't need
> the vm_uffd_ops to be accessible from the vm_operations_struct.  The
> page faullt handler can pass a vm_uffd_ops into the uffd functions that
> it calls.

Not sure I follow you here. The ops are not required by the page fault
handler, they are needed for uffd ioctl handling, e.g

        userfaultfd_ioctl(UFFDIO_COPY) ->
                mfill_atomic_copy() ->
                        vma = find_vma();
                        /* do VMA specific stuff */

-- 
Sincerely yours,
Mike.

Reply via email to