Skip to content

Commit 077309b

Browse files
yhuang-intelakpm00
authored andcommitted
migrate_pages(): fix failure counting for retry
After 10 retries, we will give up and the remaining pages will be counted as failure in nr_failed and nr_thp_failed. We should count the failure in nr_failed_pages too. This is done in this patch. Link: https://lkml.kernel.org/r/[email protected] Fixes: 5984fab ("mm: move_pages: report the number of non-attempted pages") Signed-off-by: "Huang, Ying" <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Reviewed-by: Oscar Salvador <[email protected]> Cc: Zi Yan <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e6fa8a7 commit 077309b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mm/migrate.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
14131413
int thp_retry = 1;
14141414
int nr_failed = 0;
14151415
int nr_failed_pages = 0;
1416+
int nr_retry_pages = 0;
14161417
int nr_succeeded = 0;
14171418
int nr_thp_succeeded = 0;
14181419
int nr_thp_failed = 0;
@@ -1433,6 +1434,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
14331434
for (pass = 0; pass < 10 && (retry || thp_retry); pass++) {
14341435
retry = 0;
14351436
thp_retry = 0;
1437+
nr_retry_pages = 0;
14361438

14371439
list_for_each_entry_safe(page, page2, from, lru) {
14381440
/*
@@ -1506,7 +1508,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
15061508
nr_failed++;
15071509
}
15081510

1509-
nr_failed_pages += nr_subpages;
1511+
nr_failed_pages += nr_subpages + nr_retry_pages;
15101512
/*
15111513
* There might be some subpages of fail-to-migrate THPs
15121514
* left in thp_split_pages list. Move them back to migration
@@ -1522,6 +1524,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
15221524
thp_retry++;
15231525
else
15241526
retry++;
1527+
nr_retry_pages += nr_subpages;
15251528
break;
15261529
case MIGRATEPAGE_SUCCESS:
15271530
nr_succeeded += nr_subpages;
@@ -1548,6 +1551,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
15481551
if (!no_subpage_counting)
15491552
nr_failed += retry;
15501553
nr_thp_failed += thp_retry;
1554+
nr_failed_pages += nr_retry_pages;
15511555
/*
15521556
* Try to migrate subpages of fail-to-migrate THPs, no nr_failed
15531557
* counting in this round, since all subpages of a THP is counted

0 commit comments

Comments
 (0)