if ((flags & MFILL_ATOMIC_WP) && !(dst_vma->vm_flags & VM_UFFD_WP))
return -EINVAL;
+ /*
+ * There is no default zero huge page for all huge page sizes as
+ * supported by hugetlb. A PMD_SIZE huge pages may exist as used
+ * by THP. Since we can not reliably insert a zero page, this
+ * feature is not supported.
+ */
+ if (is_vm_hugetlb_page(dst_vma) &&
+ uffd_flags_mode_is(flags, MFILL_ATOMIC_ZEROPAGE))
+ return -EINVAL;
+
uffd_ops = vma_get_uffd_ops(dst_vma);
WARN_ON_ONCE(!uffd_ops || !uffd_ops->is_dst_valid);
return uffd_ops->is_dst_valid(dst_vma, dst_start, len);
const struct vm_uffd_ops *uffd_ops;
unsigned long increment;
- /*
- * There is no default zero huge page for all huge page sizes as
- * supported by hugetlb. A PMD_SIZE huge pages may exist as used
- * by THP. Since we can not reliably insert a zero page, this
- * feature is not supported.
- */
- if (uffd_flags_mode_is(flags, MFILL_ATOMIC_ZEROPAGE)) {
- up_read(&ctx->map_changing_lock);
- uffd_mfill_unlock(dst_vma);
- return -EINVAL;
- }
-
src_addr = src_start;
dst_addr = dst_start;
copied = 0;