From: Liam R. Howlett Date: Tue, 28 Oct 2025 16:17:19 +0000 (-0400) Subject: mm/userfaultfd: Use uffd_ops to decide if continue is supported X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=56937325d91b2af46c3bd60a964ec8fd377dcd31;p=users%2Fjedix%2Flinux-maple.git mm/userfaultfd: Use uffd_ops to decide if continue is supported Instead of checking the dst_vma for two types, just check if the continue pointer is null or not. This scales for all memory types. Disable the anonymous continue operation by setting it to NULL in the default uffd_ops. Signed-off-by: Liam R. Howlett --- diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 044334323400..a7ed8224a9e1 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -517,7 +517,7 @@ static ssize_t uffd_def_is_dst_valid(struct vm_area_struct *dst_vma, static const struct vm_uffd_ops default_uffd_ops = { .copy = mfill_atomic_pte_copy, .zeropage = mfill_atomic_pte_zeropage, - .cont = mfill_atomic_pte_continue, + .cont = NULL, .poison = mfill_atomic_pte_poison, .is_dst_valid = uffd_def_is_dst_valid, .increment = mfill_size, @@ -686,7 +686,7 @@ retry: goto out_unlock; err = -EINVAL; - if (!(vma_is_shmem(dst_vma) || is_vm_hugetlb_page(dst_vma)) && + if (!uffd_ops->cont && uffd_flags_mode_is(flags, MFILL_ATOMIC_CONTINUE)) goto out_unlock;