Skip to content

Commit

Permalink
migrate_pages_batch: fix statistics for longterm pin retry
Browse files Browse the repository at this point in the history
commit 851ae64 upstream.

In commit fd4a7ac ("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.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: fd4a7ac ("mm: migrate: try again if THP split is failed due to page refcnt")
Signed-off-by: "Huang, Ying" <[email protected]>
Reviewed-by: Baolin Wang <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Yang Shi <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
yhuang-intel authored and gregkh committed Nov 8, 2024
1 parent b366022 commit 7dcd620
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,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;
}
}
Expand Down

0 comments on commit 7dcd620

Please sign in to comment.