]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/userfaultfd: Stop passing flags through continue operations
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 28 Oct 2025 16:51:22 +0000 (12:51 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 30 Oct 2025 16:48:15 +0000 (12:48 -0400)
flags are only being used for write protection, just use a boolean.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
include/linux/userfaultfd_k.h
mm/hugetlb.c
mm/userfaultfd.c

index 899ca7fb65ff90038e90ebd2939ee262890fd527..38aac8085c4b5950432426860f6e1c2862de8af6 100644 (file)
@@ -103,7 +103,7 @@ struct vm_uffd_ops {
                    struct folio **foliop, unsigned long increment);
        int (*zeropage)(struct vm_area_struct *dst_vma, unsigned long dst_addr);
        int (*cont)(struct vm_area_struct *dst_vma, unsigned long dst_addr,
-                   uffd_flags_t flags, unsigned long increment);
+                   bool wp, unsigned long increment);
        int (*poison)(struct vm_area_struct *dst_vma,
                unsigned long dst_addr, unsigned long increment);
 
@@ -241,7 +241,7 @@ int mfill_atomic_pte_poison(struct vm_area_struct *dst_vma,
                unsigned long dst_addr, unsigned long increment);
 
 int mfill_atomic_pte_continue(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, uffd_flags_t flags,
+               unsigned long dst_addr, bool wp,
                unsigned long increment);
 
 int mfill_atomic_pte_copy(struct vm_area_struct *dst_vma,
index 4f736d7c4efd6511b6d89b264527867c435d3fe4..4bc4d4a9f5fd6d6acafa5ad6ac458c455d4bff2a 100644 (file)
@@ -5533,7 +5533,7 @@ static int hugetlb_mfill_pte_poison(struct vm_area_struct *dst_vma,
                unsigned long dst_addr, unsigned long increment);
 
 static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, uffd_flags_t flags,
+               unsigned long dst_addr, bool wp_enabled,
                unsigned long increment);
 
 static int hugetlb_mfill_atomic_pte_copy(struct vm_area_struct *dst_vma,
@@ -7059,11 +7059,10 @@ out:
 }
 
 static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, uffd_flags_t flags,
+               unsigned long dst_addr, bool wp_enabled,
                unsigned long increment)
 {
        struct mm_struct *dst_mm = dst_vma->vm_mm;
-       bool wp_enabled = (flags & MFILL_ATOMIC_WP);
        struct hstate *h = hstate_vma(dst_vma);
        struct address_space *mapping = dst_vma->vm_file->f_mapping;
        pgoff_t idx = vma_hugecache_offset(h, dst_vma, dst_addr);
@@ -7077,7 +7076,7 @@ static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
        u32 hash;
 
        ret = hugetlb_mfill_prepare(dst_vma, dst_addr, increment,
-                                   &dst_pte, &hash, flags & MFILL_ATOMIC_WP);
+                                   &dst_pte, &hash, wp_enabled);
        if (ret)
                return ret;
 
index 5d9385bd35f24b6f872d59457c6a9423f28cd858..6fa840bdeee050f03793116d4ccf10376cfa04f6 100644 (file)
@@ -394,7 +394,7 @@ out:
 
 /* Handles UFFDIO_CONTINUE for all shmem VMAs (shared or private). */
 int mfill_atomic_pte_continue(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, uffd_flags_t flags,
+               unsigned long dst_addr, bool wp,
                unsigned long increment)
 {
        struct inode *inode = file_inode(dst_vma->vm_file);
@@ -426,7 +426,7 @@ int mfill_atomic_pte_continue(struct vm_area_struct *dst_vma,
        }
 
        ret = mfill_atomic_install_pte(dst_pmd, dst_vma, dst_addr,
-                                      page, false, flags & MFILL_ATOMIC_WP);
+                                      page, false, wp);
        if (ret)
                goto out_release;
 
@@ -700,7 +700,8 @@ retry:
                if (uffd_flags_mode_is(flags, MFILL_ATOMIC_POISON)) {
                        err = uffd_ops->poison(dst_vma, dst_addr, increment);
                } else if (uffd_flags_mode_is(flags, MFILL_ATOMIC_CONTINUE)) {
-                       err = uffd_ops->cont(dst_vma, dst_addr, flags,
+                       err = uffd_ops->cont(dst_vma, dst_addr,
+                                            flags & MFILL_ATOMIC_WP,
                                             increment);
                } else if (uffd_flags_mode_is(flags, MFILL_ATOMIC_COPY)) {
                        err = uffd_ops->copy(dst_vma, dst_addr, src_addr,