mm-gup-remove-vmas-array-from-internal-gup-functions.patch removed from -mm tree
The quilt patch titled
Subject: mm/gup: remove vmas array from internal GUP functions
has been removed from the -mm tree. Its filename was
mm-gup-remove-vmas-array-from-internal-gup-functions.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: Lorenzo Stoakes <[email protected]>
Subject: mm/gup: remove vmas array from internal GUP functions
Date: Wed, 17 May 2023 20:25:48 +0100
Now we have eliminated all callers to GUP APIs which use the vmas parameter, eliminate it altogether.
This eliminates a class of bugs where vmas might have been kept around longer than the mmap_lock and thus we need not be concerned about locks being dropped during this operation leaving behind dangling pointers.
This simplifies the GUP API and makes it considerably clearer as to its purpose - follow flags are applied and if pinning, an array of pages is returned.
---
include/linux/hugetlb.h | 10 +--- mm/gup.c | 83 ++++++++++++++------------------------ mm/hugetlb.c | 24 ++++------ 3 files changed, 45 insertions(+), 72 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-gup-remove-vmas-array-from-internal-gup-functions +4 -6
@@ -133,9 +133,8 @@ int copy_hugetlb_page_range(struct mm_ststruct page *hugetlb_follow_page_mask (struct vm_area_struct *vma,unsigned long address,unsigned int flags);long follow_hugetlb_page (struct mm_struct *,struct vm_area_struct *, -struct page **,struct vm_area_struct **, -unsigned long *,unsigned long *,long ,unsigned int , -int *); +struct page **,unsigned long *,unsigned long *, +long ,unsigned int ,int *);void unmap_hugepage_range (struct vm_area_struct *,unsigned long ,unsigned long ,struct page *,zap_flags_t );
@@ -306,9 +305,8 @@ static inline struct page *hugetlb_follostatic inline long follow_hugetlb_page (struct mm_struct *mm,struct vm_area_struct *vma,struct page **pages, -struct vm_area_struct **vmas,unsigned long *position, -unsigned long *nr_pages,long i,unsigned int flags, -int *nonblocking) +unsigned long *position,unsigned long *nr_pages, +long i,unsigned int flags,int *nonblocking) {BUG ();return 0 ;
mm/gup.c renamed from mm/gup.c~mm-gup-remove-vmas-array-from-internal-gup-functions +31 -52
267 lines not on this page · raw message
mm/hugetlb.c renamed from mm/hugetlb.c~mm-gup-remove-vmas-array-from-internal-gup-functions +10 -14
@@ -6425,17 +6425,14 @@ out_release_nounlock: }#endif /* CONFIG_USERFAULTFD */ -static void record_subpages_vmas (struct page *page,struct vm_area_struct *vma, -int refs,struct page **pages, -struct vm_area_struct **vmas) +static void record_subpages (struct page *page,struct vm_area_struct *vma, +int refs,struct page **pages) {int nr;for (nr =0 ; nr < refs; nr++) {if (likely (pages)) pages[nr] =nth_page (page, nr); -if (vmas) - vmas[nr] = vma; } }
@@ -6508,9 +6505,9 @@ out_unlock: }long follow_hugetlb_page (struct mm_struct *mm,struct vm_area_struct *vma, -struct page **pages,struct vm_area_struct **vmas, -unsigned long *position,unsigned long *nr_pages, -long i,unsigned int flags,int *locked) +struct page **pages,unsigned long *position, +unsigned long *nr_pages,long i,unsigned int flags, +int *locked) {unsigned long pfn_offset;unsigned long vaddr = *position;
@@ -6638,7 +6635,7 @@ long follow_hugetlb_page(struct mm_struc* If subpage information not requested, update counters * and skip the same_page loop below. */ -if (!pages && !vmas && !pfn_offset && +if (!pages && !pfn_offset && (vaddr +huge_page_size (h) < vma->vm_end) && (remainder >=pages_per_huge_page (h))) { vaddr +=huge_page_size (h);
@@ -6653,11 +6650,10 @@ long follow_hugetlb_page(struct mm_struc refs =min3 (pages_per_huge_page (h) - pfn_offset, remainder, (vma->vm_end -ALIGN_DOWN (vaddr,PAGE_SIZE )) >>PAGE_SHIFT ); -if (pages || vmas) -record_subpages_vmas (nth_page (page, pfn_offset), - vma, refs, -likely (pages) ? pages + i :NULL , - vmas ? vmas + i :NULL ); +if (pages) +record_subpages (nth_page (page, pfn_offset), + vma, refs, +likely (pages) ? pages + i :NULL );if (pages) {/*
_
Patches currently in -mm which might be from [email protected] are
mm-vmalloc-do-not-output-a-spurious-warning-when-huge-vmalloc-fails.patch