Skip to contentSkip to conversation

mm-migrate_device-return-number-of-migrating-pages-in-args-cpages.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Nov 23, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled

     Subject: mm/migrate_device: return number of migrating pages in args->cpages

has been removed from the -mm tree. Its filename was
mm-migrate_device-return-number-of-migrating-pages-in-args-cpages.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Alistair Popple <[email protected]>
Subject: mm/migrate_device: return number of migrating pages in args->cpages
Date: Fri, 11 Nov 2022 11:51:35 +1100

migrate_vma->cpages originally contained a count of the number of pages migrating including non-present pages which can be populated directly on the target.

Commit 241f68859656 ("mm/migrate_device.c: refactor migrate_vma and migrate_device_coherent_page()") inadvertantly changed this to contain just the number of pages that were unmapped. Usage of migrate_vma->cpages isn't documented, but most drivers use it to see if all the requested addresses can be migrated so restore the original behaviour.

Fixes 241f68859656 ("mm/migrate_device.c: refactor migrate_vma and migrate_deivce_coherent_page()")
Cc John Hubbard <[email protected]>
Cc Alex Sierra <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc Felix Kuehling <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Michael Ellerman <[email protected]>

---

 mm/migrate_device.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
mm/migrate_device.c renamed from mm/migrate_device.c~mm-migrate_device-return-number-of-migrating-pages-in-args-cpages +6 -2
@@ -357,7 +357,8 @@ static bool migrate_vma_check_page(struc
 }
 
 /*
- * Unmaps pages for migration. Returns number of unmapped pages.
+ * Unmaps pages for migration. Returns number of source pfns marked as
+ * migrating.
  */
 static unsigned long migrate_device_unmap(unsigned long *src_pfns,
 					  unsigned long npages,
@@ -373,8 +374,11 @@ static unsigned long migrate_device_unma
 		struct page *page = migrate_pfn_to_page(src_pfns[i]);
 		struct folio *folio;
 
-		if (!page)
+		if (!page) {
+			if (src_pfns[i] & MIGRATE_PFN_MIGRATE)
+				unmapped++;
 			continue;
+		}
 
 		/* ZONE_DEVICE pages are not on LRU */
 		if (!is_zone_device_page(page)) {

_

Patches currently in -mm which might be from [email protected] are