Re: [PATCH v2 1/4] mm: Introduce vm_uffd_ops API
From: Peter Xu
Date: Thu Sep 18 2025 - 14:20:57 EST
On Thu, Sep 18, 2025 at 07:53:46PM +0200, David Hildenbrand wrote:
> Re Nikita: If we could just reuse fault() for userfaultfd purposes, that
> might actually be pretty nice.
I commented on that.
https://lore.kernel.org/all/aEiwHjl4tsUt98sh@x1.local/
That'll need to leak FAULT_FLAG_USERFAULT_CONTINUE which isn't necessary,
make it extremely hard to know when to set the flag, and comlicates the
fault path which isn't necessary.
I think Mike's comment was spot on, that the new API is literally
do_fault() for shmem, but only used in userfaultfd context so it's even an
oneliner.
I do not maintain mm, so above is only my two cents, so I don't make
decisions. Personally I still prefer the current approach of keep the mm
main fault path clean.
Besides, this series also cleans up other places all over the places, the
vm_uffd_ops is a most simplified version of description for a memory type.
So IMHO it's beneficial in other aspects as well. If uffd_copy() is a
concern, fine, we drop it. We don't plan to have more use of UFFDIO_COPY
outside of the known three memory types after all.
Thanks,
--
Peter Xu