diff mbox series

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

Message ID 20220304093409.25829-6-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup and fixup patches for migration | expand

Commit Message

Miaohe Lin March 4, 2022, 9:33 a.m. UTC
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@huawei.com>
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Muchun Song March 4, 2022, 12:20 p.m. UTC | #1
On Fri, Mar 4, 2022 at 5:35 PM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> 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@huawei.com>

At least I agree with you.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>
diff mbox series

Patch

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;