]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/userfaultfd: Change pte_poison() prototypes to use new uffd_info struct
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 28 Oct 2025 19:49:15 +0000 (15:49 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 30 Oct 2025 16:50:14 +0000 (12:50 -0400)
It is cleaner to use the uffd_info struct.

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

index 8898671bde6e0d6e8168ccfcd91ae14f994a8bf1..2e98d7b282f0a119f26e9c6d35933776d8de8c9b 100644 (file)
@@ -122,9 +122,7 @@ struct vm_uffd_ops {
        int (*zeropage)(struct uffd_info *info);
        int (*cont)(struct vm_area_struct *dst_vma, unsigned long dst_addr,
                    bool wp, unsigned long increment);
-       int (*poison)(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, unsigned long increment);
-
+       int (*poison)(struct uffd_info *info);
        /* Required features below */
        ssize_t (*is_dst_valid)(struct vm_area_struct *dst_vma,
                                unsigned long dst_start, unsigned long len);
@@ -255,9 +253,7 @@ static inline unsigned long mfill_size(struct vm_area_struct *vma)
 {
        return PAGE_SIZE;
 }
-int mfill_atomic_pte_poison(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, unsigned long increment);
-
+int mfill_atomic_pte_poison(struct uffd_info *info);
 int mfill_atomic_pte_continue(struct vm_area_struct *dst_vma,
                unsigned long dst_addr, bool wp,
                unsigned long increment);
index 8abdb4bb89d4853167a35f6f66b41c1f07a3b43d..3670e01508187cd7486a15b1741a48f6c1f3a87d 100644 (file)
@@ -5529,9 +5529,7 @@ static ssize_t hugetlb_failed_do_unlock(struct userfaultfd_ctx *ctx,
        return copy_folio_from_user(folio,(const void __user *)src_addr, true);
 }
 
-static int hugetlb_mfill_pte_poison(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, unsigned long increment);
-
+static int hugetlb_mfill_pte_poison(struct uffd_info *info);
 static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
                unsigned long dst_addr, bool wp_enabled,
                unsigned long increment);
@@ -7014,9 +7012,10 @@ static ssize_t hugetlb_is_dst_valid(struct vm_area_struct *dst_vma,
        return 0;
 }
 
-static int hugetlb_mfill_pte_poison(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, unsigned long increment)
+static int hugetlb_mfill_pte_poison(struct uffd_info *info)
 {
+       struct vm_area_struct *dst_vma = info->dst_vma;
+       unsigned long dst_addr = info->dst_addr;
        struct mm_struct *dst_mm = dst_vma->vm_mm;
        struct hstate *h = hstate_vma(dst_vma);
        unsigned long size = huge_page_size(h);
@@ -7026,7 +7025,7 @@ static int hugetlb_mfill_pte_poison(struct vm_area_struct *dst_vma,
        int ret;
        u32 hash;
 
-       ret = hugetlb_mfill_prepare(dst_vma, dst_addr, increment,
+       ret = hugetlb_mfill_prepare(dst_vma, dst_addr, info->increment,
                                    &dst_pte, &hash,
                                    0 /* Not a continue, no one cares. */);
        if (ret)
index 809e23716fdcc96c1b7320cb52f0aa2e3a7de63a..802aaf15573d8a3448a41f9a3bf31e77ab0b7aa4 100644 (file)
@@ -443,11 +443,12 @@ out_release:
 }
 
 /* Handles UFFDIO_POISON for all non-hugetlb VMAs. */
-int mfill_atomic_pte_poison(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, unsigned long increment)
+int mfill_atomic_pte_poison(struct uffd_info *info)
 {
        int ret;
+       struct vm_area_struct *dst_vma = info->dst_vma;
        struct mm_struct *dst_mm = dst_vma->vm_mm;
+       unsigned long dst_addr = info->dst_addr;
        pmd_t *dst_pmd;
        pte_t _dst_pte, *dst_pte;
        spinlock_t *ptl;
@@ -692,8 +693,7 @@ retry:
                 * tables under us; pte_offset_map_lock() will deal with that.
                 */
                if (uffd_flags_mode_is(flags, MFILL_ATOMIC_POISON)) {
-                       err = info.uffd_ops->poison(dst_vma, info.dst_addr,
-                                                   increment);
+                       err = info.uffd_ops->poison(&info);
                } else if (uffd_flags_mode_is(flags, MFILL_ATOMIC_CONTINUE)) {
                        err = info.uffd_ops->cont(dst_vma, info.dst_addr,
                                             flags & MFILL_ATOMIC_WP,