Skip to contentSkip to conversation

migrate_pages_batch: fix statistics for longterm pin retry

PATCH Applied Huang Ying 2 participants 2 messages Apr 16, 2023 – Apr 19, 2023

Subsystems (2)
lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/1 migrate_pages_batch: fix statistics for longterm pin retry

In commit fd4a7ac32918 ("mm: migrate: try again if THP split is failed due to page refcnt"), if the THP splitting fails due to page reference count, we will retry to improve migration successful rate. But the failed splitting is counted as migration failure and migration retry, which will cause duplicated failure counting. So, in this patch, this is fixed via undoing the failure counting if we decide to retry. The patch is tested via failure injection.

Fixes fd4a7ac32918 ("mm: migrate: try again if THP split is failed due to page refcnt")
Cc Baolin Wang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Yang Shi <[email protected]>
Cc Zi Yan <[email protected]>
---
 mm/migrate.c | 3 +++
 1 file changed, 3 insertions(+)
mm/migrate.c +3 -0
index b34a0f383795..47a1e8445f45 100644
@@ -1743,6 +1743,9 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page,
 							large_retry++;
 							thp_retry += is_thp;
 							nr_retry_pages += nr_pages;
+							/* Undo duplicated failure counting. */
+							nr_large_failed--;
+							stats->nr_thp_failed -= is_thp;
 							break;
 						}
 					}
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Huang Ying

In commit fd4a7ac32918 ("mm: migrate: try again if THP split is failed due to page refcnt"), if the THP splitting fails due to page reference count, we will retry to improve migration successful rate. But the failed splitting is counted as migration failure and migration retry, which will cause duplicated failure counting. So, in this patch, this is fixed via undoing the failure counting if we decide to retry. The patch is tested via failure injection.

Makes sense to me. Thanks.

Quoted 25 lines
Fixes fd4a7ac32918 ("mm: migrate: try again if THP split is failed due to page refcnt")
Cc Baolin Wang <[email protected]>
Cc Alistair Popple <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Yang Shi <[email protected]>
Cc Zi Yan <[email protected]>
---
  mm/migrate.c | 3 +++
  1 file changed, 3 insertions(+)
mm/migrate.c +3 -0
index b34a0f383795..47a1e8445f45 100644
@@ -1743,6 +1743,9 @@ static int migrate_pages_batch(struct list_head *from, new_page_t get_new_page,
  							large_retry++;
  							thp_retry += is_thp;
  							nr_retry_pages += nr_pages;
+							/* Undo duplicated failure counting. */
+							nr_large_failed--;
+							stats->nr_thp_failed -= is_thp;
  							break;
  						}
  					}