linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: gup: Re-pin pages in case of trying several times to migrate
@ 2022-10-20  7:49 Baolin Wang
  2022-10-20  7:49 ` [PATCH 2/2] mm: migrate: Try again if THP split is failed due to page refcnt Baolin Wang
  2022-10-20  8:15 ` [PATCH 1/2] mm: gup: Re-pin pages in case of trying several times to migrate Huang, Ying
  0 siblings, 2 replies; 11+ messages in thread
From: Baolin Wang @ 2022-10-20  7:49 UTC (permalink / raw)
  To: akpm
  Cc: david, ying.huang, ziy, shy828301, baolin.wang, jingshan,
	linux-mm, linux-kernel

The migrate_pages() will return the number of {normal page, THP, hugetlb}
that were not migrated, or an error code. That means it can still return
the number of failure count, though the pages have been migrated
successfully with several times re-try.

So we should not use the return value of migrate_pages() to determin
if there are pages are failed to migrate. Instead we can validate the
'movable_page_list' to see if there are pages remained in the list,
which are failed to migrate. That can mitigate the failure of longterm
pinning.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/gup.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 5182aba..bd8cfcd 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1914,9 +1914,10 @@ static int migrate_longterm_unpinnable_pages(
 			.gfp_mask = GFP_USER | __GFP_NOWARN,
 		};
 
-		if (migrate_pages(movable_page_list, alloc_migration_target,
-				  NULL, (unsigned long)&mtc, MIGRATE_SYNC,
-				  MR_LONGTERM_PIN, NULL)) {
+		ret = migrate_pages(movable_page_list, alloc_migration_target,
+				    NULL, (unsigned long)&mtc, MIGRATE_SYNC,
+				    MR_LONGTERM_PIN, NULL);
+		if (ret < 0 || !list_empty(movable_page_list)) {
 			ret = -ENOMEM;
 			goto err;
 		}
-- 
1.8.3.1



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

end of thread, other threads:[~2022-10-21  6:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20  7:49 [PATCH 1/2] mm: gup: Re-pin pages in case of trying several times to migrate Baolin Wang
2022-10-20  7:49 ` [PATCH 2/2] mm: migrate: Try again if THP split is failed due to page refcnt Baolin Wang
2022-10-20  8:24   ` Huang, Ying
2022-10-20  9:33     ` Baolin Wang
2022-10-20 19:21       ` Yang Shi
2022-10-21  6:15         ` Baolin Wang
2022-10-20  8:15 ` [PATCH 1/2] mm: gup: Re-pin pages in case of trying several times to migrate Huang, Ying
2022-10-20  9:24   ` Baolin Wang
2022-10-20 11:43     ` Alistair Popple
2022-10-21  0:28       ` Huang, Ying
2022-10-21  2:51       ` Baolin Wang

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