Skip to contentSkip to conversation

mm-migrate-make-migrate_misplaced_folio-return-0-on-success.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jun 29, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/migrate: make migrate_misplaced_folio() return 0 on success
has been removed from the -mm tree. Its filename was
mm-migrate-make-migrate_misplaced_folio-return-0-on-success.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: David Hildenbrand <[email protected]>
Subject: mm/migrate: make migrate_misplaced_folio() return 0 on success
Date: Thu, 20 Jun 2024 23:29:34 +0200

Patch series "mm/migrate: move NUMA hinting fault folio isolation + checks under PTL".

Let's just return 0 on success, which is less confusing.

... especially because we got it wrong in the migrate.h stub where we have "return -EAGAIN; /* can't migrate now */" instead of "return 0;". Likely this wrong return value doesn't currently matter, but it certainly adds confusion.

We'll add migrate_misplaced_folio_prepare() next, where we want to use the same "return 0 on success" approach, so let's just clean this up.

---

 mm/huge_memory.c |    5 ++---
 mm/memory.c      |    2 +-
 mm/migrate.c     |    4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-migrate-make-migrate_misplaced_folio-return-0-on-success +2 -3
@@ -1653,7 +1653,7 @@ vm_fault_t do_huge_pmd_numa_page(struct
 	unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
 	int nid = NUMA_NO_NODE;
 	int target_nid, last_cpupid = (-1 & LAST_CPUPID_MASK);
-	bool migrated = false, writable = false;
+	bool writable = false;
 	int flags = 0;
 
 	vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);
@@ -1697,8 +1697,7 @@ vm_fault_t do_huge_pmd_numa_page(struct
 	spin_unlock(vmf->ptl);
 	writable = false;
 
-	migrated = migrate_misplaced_folio(folio, vma, target_nid);
-	if (migrated) {
+	if (!migrate_misplaced_folio(folio, vma, target_nid)) {
 		flags |= TNF_MIGRATED;
 		nid = target_nid;
 	} else {
mm/memory.c renamed from mm/memory.c~mm-migrate-make-migrate_misplaced_folio-return-0-on-success +1 -1
@@ -5357,7 +5357,7 @@ static vm_fault_t do_numa_page(struct vm
 	ignore_writable = true;
 
 	/* Migrate to the requested node */
-	if (migrate_misplaced_folio(folio, vma, target_nid)) {
+	if (!migrate_misplaced_folio(folio, vma, target_nid)) {
 		nid = target_nid;
 		flags |= TNF_MIGRATED;
 	} else {
mm/migrate.c renamed from mm/migrate.c~mm-migrate-make-migrate_misplaced_folio-return-0-on-success +2 -2
@@ -2618,11 +2618,11 @@ int migrate_misplaced_folio(struct folio
 					    nr_succeeded);
 	}
 	BUG_ON(!list_empty(&migratepages));
-	return isolated;
+	return isolated ? 0 : -EAGAIN;
 
 out:
 	folio_put(folio);
-	return 0;
+	return -EAGAIN;
 }
 #endif /* CONFIG_NUMA_BALANCING */
 #endif /* CONFIG_NUMA */

_

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