From: Liam R. Howlett Date: Tue, 28 Oct 2025 19:49:15 +0000 (-0400) Subject: mm/userfaultfd: Change pte_poison() prototypes to use new uffd_info struct X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=93f1506f884ab14bf6aa987e607169c39547ee70;p=users%2Fjedix%2Flinux-maple.git mm/userfaultfd: Change pte_poison() prototypes to use new uffd_info struct It is cleaner to use the uffd_info struct. Signed-off-by: Liam R. Howlett --- diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h index 8898671bde6e..2e98d7b282f0 100644 --- a/include/linux/userfaultfd_k.h +++ b/include/linux/userfaultfd_k.h @@ -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); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 8abdb4bb89d4..3670e0150818 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -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) diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 809e23716fdc..802aaf15573d 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -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,