linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/migrate.c: Fix return code when migration fails
@ 2023-08-07  6:39 Alistair Popple
  2023-08-07  6:39 ` [PATCH 2/2] selftests/migration: Disable NUMA balancing and check migration status Alistair Popple
  2023-08-07  8:39 ` [PATCH 1/2] mm/migrate.c: Fix return code when migration fails Michal Hocko
  0 siblings, 2 replies; 16+ messages in thread
From: Alistair Popple @ 2023-08-07  6:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, mhocko, jhubbard, ying.huang, osalvador, baolin.wang,
	ziy, shy828301, ryan.roberts, Alistair Popple

When a page fails to migrate move_pages() returns the error code in a
per-page array of status values. The function call itself is also
supposed to return a summary error code indicating that a failure
occurred.

This doesn't always happen. Instead success can be returned even
though some pages failed to migrate. This is due to incorrectly
returning the error code from store_status() rather than the code from
add_page_for_migration. Fix this by only returning an error from
store_status() if the store actually failed.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
Fixes: a49bd4d71637 ("mm, numa: rework do_pages_move")
---
 mm/migrate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 24baad2571e3..bb3a37245e13 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2222,7 +2222,9 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
 		 * If the page is already on the target node (!err), store the
 		 * node, otherwise, store the err.
 		 */
-		err = store_status(status, i, err ? : current_node, 1);
+		err1 = store_status(status, i, err ? : current_node, 1);
+		if (err1)
+			err = err1;
 		if (err)
 			goto out_flush;
 
-- 
2.39.2



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-08-11  7:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07  6:39 [PATCH 1/2] mm/migrate.c: Fix return code when migration fails Alistair Popple
2023-08-07  6:39 ` [PATCH 2/2] selftests/migration: Disable NUMA balancing and check migration status Alistair Popple
2023-08-07  9:15   ` Ryan Roberts
2023-08-07 12:41     ` Alistair Popple
2023-08-07 13:42       ` Ryan Roberts
2023-08-09  4:21         ` Alistair Popple
2023-08-09  9:34           ` David Hildenbrand
2023-08-09 13:39             ` Ryan Roberts
2023-08-10  8:23               ` Alistair Popple
2023-08-09  9:35   ` David Hildenbrand
2023-08-09 10:46     ` Alistair Popple
2023-08-07  8:39 ` [PATCH 1/2] mm/migrate.c: Fix return code when migration fails Michal Hocko
2023-08-07 12:31   ` Alistair Popple
2023-08-07 13:07     ` Michal Hocko
2023-08-09  4:10       ` Alistair Popple
2023-08-11  7:37         ` Huang, Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox