mm-userfaultfd-dont-pass-around-both-mm-and-vma.patch removed from -mm tree
The quilt patch titled
Subject: mm: userfaultfd: don't pass around both mm and vma
has been removed from the -mm tree. Its filename was
mm-userfaultfd-dont-pass-around-both-mm-and-vma.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Axel Rasmussen <[email protected]>
Subject: mm: userfaultfd: don't pass around both mm and vma
Date: Tue, 14 Mar 2023 15:12:48 -0700
Quite a few userfaultfd functions took both mm and vma pointers as arguments. Since the mm is trivially accessible via vma->vm_mm, there's no reason to pass both; it just needlessly extends the already long argument list.
Get rid of the mm pointer, where possible, to shorten the argument list.
---
fs/userfaultfd.c | 2 - include/linux/hugetlb.h | 5 +- include/linux/shmem_fs.h | 4 +- include/linux/userfaultfd_k.h | 4 +- mm/hugetlb.c | 4 +- mm/shmem.c | 7 +-- mm/userfaultfd.c | 61 +++++++++++++++----------------- 7 files changed, 41 insertions(+), 46 deletions(-)
fs/userfaultfd.c renamed from fs/userfaultfd.c~mm-userfaultfd-dont-pass-around-both-mm-and-vma +1 -1
@@ -1644,7 +1644,7 @@ static int userfaultfd_unregister(struct/* Reset ptes for the whole vma range if wr-protected */ if (userfaultfd_wp (vma)) -uffd_wp_range (mm, vma, start, vma_end - start, false); +uffd_wp_range (vma, start, vma_end - start, false); new_flags = vma->vm_flags & ~__VM_UFFD_FLAGS; prev = vma_merge(&vmi, mm, prev, start, vma_end, new_flags,
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-userfaultfd-dont-pass-around-both-mm-and-vma +2 -3
@@ -158,7 +158,7 @@ unsigned long hugetlb_total_pages(void);vm_fault_t hugetlb_fault (struct mm_struct *mm,struct vm_area_struct *vma,unsigned long address,unsigned int flags);#ifdef CONFIG_USERFAULTFD -int hugetlb_mfill_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte, +int hugetlb_mfill_atomic_pte(pte_t *dst_pte, struct vm_area_struct *dst_vma, unsigned long dst_addr, unsigned long src_addr,
@@ -393,8 +393,7 @@ static inline void hugetlb_free_pgd_rang }#ifdef CONFIG_USERFAULTFD -static inline int hugetlb_mfill_atomic_pte(struct mm_struct *dst_mm, - pte_t *dst_pte, +static inline int hugetlb_mfill_atomic_pte(pte_t *dst_pte, struct vm_area_struct *dst_vma, unsigned long dst_addr, unsigned long src_addr,
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~mm-userfaultfd-dont-pass-around-both-mm-and-vma +2 -2
@@ -152,14 +152,14 @@ extern void shmem_uncharge(struct inode#ifdef CONFIG_USERFAULTFD #ifdef CONFIG_SHMEM -extern int shmem_mfill_atomic_pte (struct mm_struct *dst_mm,pmd_t *dst_pmd, +extern int shmem_mfill_atomic_pte (pmd_t *dst_pmd,struct vm_area_struct *dst_vma,unsigned long dst_addr,unsigned long src_addr,bool zeropage,bool wp_copy,struct page **pagep);#else /* !CONFIG_SHMEM */ -#define shmem_mfill_atomic_pte (dst_mm, dst_pmd, dst_vma, dst_addr, \ +#define shmem_mfill_atomic_pte (dst_pmd, dst_vma, dst_addr, \ src_addr, zeropage, wp_copy, pagep) ({ BUG(); 0; })#endif /* CONFIG_SHMEM */ #endif /* CONFIG_USERFAULTFD */
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~mm-userfaultfd-dont-pass-around-both-mm-and-vma +2 -2
@@ -56,7 +56,7 @@ enum mcopy_atomic_mode { MCOPY_ATOMIC_CONTINUE, }; -extern int mfill_atomic_install_pte (struct mm_struct *dst_mm,pmd_t *dst_pmd, +extern int mfill_atomic_install_pte (pmd_t *dst_pmd,struct vm_area_struct *dst_vma,unsigned long dst_addr,struct page *page,bool newly_allocated,bool wp_copy);
@@ -73,7 +73,7 @@ extern ssize_t mfill_atomic_continue(strextern int mwriteprotect_range (struct mm_struct *dst_mm,unsigned long start,unsigned long len,bool enable_wp,atomic_t *mmap_changing); -extern long uffd_wp_range (struct mm_struct *dst_mm,struct vm_area_struct *vma, +extern long uffd_wp_range (struct vm_area_struct *vma,unsigned long start,unsigned long len,bool enable_wp);/* mm helpers */
mm/hugetlb.c renamed from mm/hugetlb.c~mm-userfaultfd-dont-pass-around-both-mm-and-vma +2 -2
@@ -6159,8 +6159,7 @@ out_mutex:* Used by userfaultfd UFFDIO_* ioctls. Based on userfaultfd's mfill_atomic_pte * with modifications for hugetlb pages. */ -int hugetlb_mfill_atomic_pte(struct mm_struct *dst_mm, - pte_t *dst_pte, +int hugetlb_mfill_atomic_pte(pte_t *dst_pte, struct vm_area_struct *dst_vma, unsigned long dst_addr, unsigned long src_addr,
@@ -6168,6 +6167,7 @@ int hugetlb_mfill_atomic_pte(struct mm_s struct page **pagep, bool wp_copy) { +struct mm_struct *dst_mm = dst_vma->vm_mm;bool is_continue = (mode ==MCOPY_ATOMIC_CONTINUE );struct hstate *h =hstate_vma (dst_vma);struct address_space *mapping = dst_vma->vm_file->f_mapping;
mm/shmem.c renamed from mm/shmem.c~mm-userfaultfd-dont-pass-around-both-mm-and-vma +3 -4
@@ -2429,8 +2429,7 @@ static struct inode *shmem_get_inode(str }#ifdef CONFIG_USERFAULTFD -int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, - pmd_t *dst_pmd, +int shmem_mfill_atomic_pte(pmd_t *dst_pmd, struct vm_area_struct *dst_vma, unsigned long dst_addr, unsigned long src_addr,
@@ -2520,11 +2519,11 @@ int shmem_mfill_atomic_pte(struct mm_str goto out_release; ret =shmem_add_to_page_cache (folio, mapping, pgoff,NULL , - gfp &GFP_RECLAIM_MASK , dst_mm); + gfp &GFP_RECLAIM_MASK , dst_vma->vm_mm);if (ret) goto out_release; - ret =mfill_atomic_install_pte (dst_mm, dst_pmd, dst_vma, dst_addr, + ret =mfill_atomic_install_pte (dst_pmd, dst_vma, dst_addr, &folio->page, true, wp_copy);if (ret) goto out_delete_from_cache;
mm/userfaultfd.c renamed from mm/userfaultfd.c~mm-userfaultfd-dont-pass-around-both-mm-and-vma +29 -32
189 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are