[PATCH 05/16] mm/migration: fix the confusing PageTransHuge check

From: Miaohe Lin
Date: Fri Mar 04 2022 - 04:35:28 EST


prep_transhuge_page should be called when PageTransHuge(page) is true.
The newly allocated new_page is not yet PageTransHuge though it could
pass the check as PageTransHuge only checks PageHead now.

Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 26943bd819e8..15cac2dabc93 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1560,7 +1560,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private)

new_page = __alloc_pages(gfp_mask, order, nid, mtc->nmask);

- if (new_page && PageTransHuge(new_page))
+ if (new_page && PageTransHuge(page))
prep_transhuge_page(new_page);

return new_page;
--
2.23.0