Skip to content

Commit 7047b5a

Browse files
Baolin Wangakpm00
authored andcommitted
mm: migrate: do not retry 10 times for the subpages of fail-to-migrate THP
If THP is failed to migrate due to -ENOSYS or -ENOMEM case, the THP will be split, and the subpages of fail-to-migrate THP will be tried to migrate again, so we should not account the retry counter in the second loop, since we already accounted 'nr_thp_failed' in the first loop. Moreover we also do not need retry 10 times for -EAGAIN case for the subpages of fail-to-migrate THP in the second loop, since we already regarded the THP as migration failure, and save some migration time (for the worst case, will try 512 * 10 times) according to previous discussion [1]. [1] https://lore.kernel.org/linux-mm/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Tested-by: "Huang, Ying" <[email protected]> Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: "Huang, Ying" <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Zi Yan <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 077309b commit 7047b5a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mm/migrate.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
15221522
case -EAGAIN:
15231523
if (is_thp)
15241524
thp_retry++;
1525-
else
1525+
else if (!no_subpage_counting)
15261526
retry++;
15271527
nr_retry_pages += nr_subpages;
15281528
break;
@@ -1548,8 +1548,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
15481548
}
15491549
}
15501550
}
1551-
if (!no_subpage_counting)
1552-
nr_failed += retry;
1551+
nr_failed += retry;
15531552
nr_thp_failed += thp_retry;
15541553
nr_failed_pages += nr_retry_pages;
15551554
/*

0 commit comments

Comments
 (0)