diff mbox series

[alternative-merged] mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages.patch removed from -mm tree

Message ID 20201104024024.gT0sT%akpm@linux-foundation.org
State New
Headers show
Series [alternative-merged] mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages.patch removed from -mm tree | expand

Commit Message

Andrew Morton Nov. 4, 2020, 2:40 a.m. UTC
The patch titled
     Subject: mm/gup: use unpin_user_pages() in check_and_migrate_cma_pages()
has been removed from the -mm tree.  Its filename was
     mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages.patch

This patch was dropped because an alternative patch was merged

------------------------------------------------------
From: Jason Gunthorpe <jgg@nvidia.com>
Subject: mm/gup: use unpin_user_pages() in check_and_migrate_cma_pages()

When FOLL_PIN is passed to __get_user_pages() the page list must be put
back using unpin_user_pages() otherwise the page pin reference persists in
a corrupted state.

Link: https://lkml.kernel.org/r/0-v1-976effcd4468+d4-gup_cma_fix_jgg@nvidia.com
Fixes: 3faa52c03f44 ("mm/gup: track FOLL_PIN pages")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/gup.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

--- a/mm/gup.c~mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages
+++ a/mm/gup.c
@@ -1647,8 +1647,11 @@  check_again:
 		/*
 		 * drop the above get_user_pages reference.
 		 */
-		for (i = 0; i < nr_pages; i++)
-			put_page(pages[i]);
+		if (gup_flags & FOLL_PIN)
+			unpin_user_pages(pages, nr_pages);
+		else
+			for (i = 0; i < nr_pages; i++)
+				put_page(pages[i]);
 
 		if (migrate_pages(&cma_page_list, alloc_migration_target, NULL,
 			(unsigned long)&mtc, MIGRATE_SYNC, MR_CONTIG_RANGE)) {