]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/userfaultfd: Change pte_cont() prototypes to use new uffd_info struct
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 28 Oct 2025 20:19:45 +0000 (16:19 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 30 Oct 2025 16:50:17 +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 2e98d7b282f0a119f26e9c6d35933776d8de8c9b..48de71e7e599a5ca6d02441b6efb7019da10cfcb 100644 (file)
@@ -120,8 +120,7 @@ ssize_t uffd_failed_do_unlock(struct userfaultfd_ctx *ctx,
 struct vm_uffd_ops {
        int (*copy)(struct uffd_info *info);
        int (*zeropage)(struct uffd_info *info);
-       int (*cont)(struct vm_area_struct *dst_vma, unsigned long dst_addr,
-                   bool wp, unsigned long increment);
+       int (*cont)(struct uffd_info *info);
        int (*poison)(struct uffd_info *info);
        /* Required features below */
        ssize_t (*is_dst_valid)(struct vm_area_struct *dst_vma,
@@ -254,10 +253,7 @@ static inline unsigned long mfill_size(struct vm_area_struct *vma)
        return PAGE_SIZE;
 }
 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);
-
+int mfill_atomic_pte_continue(struct uffd_info *info);
 int mfill_atomic_pte_copy(struct uffd_info *info);
 int mfill_atomic_pte_zeropage(struct uffd_info *info);
 
index 3670e01508187cd7486a15b1741a48f6c1f3a87d..97b402762921d3c33562b680f5197a19d400fc8e 100644 (file)
@@ -5530,10 +5530,7 @@ static ssize_t hugetlb_failed_do_unlock(struct userfaultfd_ctx *ctx,
 }
 
 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);
-
+static int hugetlb_mfill_pte_continue(struct uffd_info *info);
 static int hugetlb_mfill_atomic_pte_copy(struct uffd_info *info);
 
 static const struct vm_uffd_ops hugetlb_uffd_ops = {
@@ -7054,10 +7051,10 @@ out:
        return 0;
 }
 
-static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
-               unsigned long dst_addr, bool wp_enabled,
-               unsigned long increment)
+static int hugetlb_mfill_pte_continue(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);
        struct address_space *mapping = dst_vma->vm_file->f_mapping;
@@ -7071,8 +7068,8 @@ static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
        struct folio *folio;
        u32 hash;
 
-       ret = hugetlb_mfill_prepare(dst_vma, dst_addr, increment,
-                                   &dst_pte, &hash, wp_enabled);
+       ret = hugetlb_mfill_prepare(dst_vma, dst_addr, info->increment,
+                                   &dst_pte, &hash, info->wp);
        if (ret)
                return ret;
 
@@ -7113,7 +7110,7 @@ static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
         * For either: (1) CONTINUE on a non-shared VMA, or (2) UFFDIO_COPY
         * with wp flag set, don't set pte write bit.
         */
-       _dst_pte = make_huge_pte(dst_vma, folio, !wp_enabled && vm_shared);
+       _dst_pte = make_huge_pte(dst_vma, folio, !info->wp && vm_shared);
        /*
         * Always mark UFFDIO_COPY page dirty; note that this may not be
         * extremely important for hugetlbfs for now since swapping is not
@@ -7123,7 +7120,7 @@ static int hugetlb_mfill_pte_continue(struct vm_area_struct *dst_vma,
        _dst_pte = huge_pte_mkdirty(_dst_pte);
        _dst_pte = pte_mkyoung(_dst_pte);
 
-       if (wp_enabled)
+       if (info->wp)
                _dst_pte = huge_pte_mkuffd_wp(_dst_pte);
 
        set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte, size);
index 802aaf15573d8a3448a41f9a3bf31e77ab0b7aa4..1d80abd625a2c6eb8ec5b3c08071c83209edf3d0 100644 (file)
@@ -395,18 +395,17 @@ 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, bool wp,
-               unsigned long increment)
+int mfill_atomic_pte_continue(struct uffd_info *info)
 {
+       struct vm_area_struct *dst_vma = info->dst_vma;
        struct inode *inode = file_inode(dst_vma->vm_file);
-       pgoff_t pgoff = linear_page_index(dst_vma, dst_addr);
+       pgoff_t pgoff = linear_page_index(dst_vma, info->dst_addr);
        pmd_t *dst_pmd;
        struct folio *folio;
        struct page *page;
        int ret;
 
-       ret = uffd_get_dst_pmd(dst_vma, dst_addr, &dst_pmd);
+       ret = uffd_get_dst_pmd(dst_vma, info->dst_addr, &dst_pmd);
        if (ret)
                return ret;
 
@@ -427,8 +426,8 @@ int mfill_atomic_pte_continue(struct vm_area_struct *dst_vma,
                goto out_release;
        }
 
-       ret = mfill_atomic_install_pte(dst_pmd, dst_vma, dst_addr,
-                                      page, false, wp);
+       ret = mfill_atomic_install_pte(dst_pmd, dst_vma, info->dst_addr,
+                                      page, false, info->wp);
        if (ret)
                goto out_release;
 
@@ -695,9 +694,7 @@ retry:
                if (uffd_flags_mode_is(flags, MFILL_ATOMIC_POISON)) {
                        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,
-                                            increment);
+                       err = info.uffd_ops->cont(&info);
                } else if (uffd_flags_mode_is(flags, MFILL_ATOMIC_COPY)) {
                        err = info.uffd_ops->copy(&info);
                        /*