mm: migrate: use thp_order instead of HPAGE_PMD_ORDER for new page allocation.
Subsystems (3)
PATCH 1/1 mm: migrate: use thp_order instead of HPAGE_PMD_ORDER for new page allocation.
From: Zi Yan <[email protected]>
With folios support, it is possible to have other than HPAGE_PMD_ORDER THPs, in the form of folios, in the system. Use thp_order() to correctly determine the source page order during migration.
--- mm/mempolicy.c | 2 +- mm/migrate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
mm/mempolicy.c +1 -1
@@ -1209,7 +1209,7 @@ static struct page *new_page(struct page *page, unsigned long start)struct page *thp; thp =alloc_hugepage_vma (GFP_TRANSHUGE , vma, address, -HPAGE_PMD_ORDER ); +thp_order (page));if (!thp)return NULL ;prep_transhuge_page (thp);
mm/migrate.c +1 -1
@@ -1553,7 +1553,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private)*/ gfp_mask &= ~__GFP_RECLAIM; gfp_mask |=GFP_TRANSHUGE ; - order =HPAGE_PMD_ORDER ; + order =thp_order (page); } zidx =zone_idx (page_zone (page));if (is_highmem_idx (zidx) || zidx ==ZONE_MOVABLE )
Signature · 1 line
2.35.1
Andrew Morton
maintainerQuoted 5 lines · On Mon, 4 Apr 2022 12:53:25 -0400 Zi Yan <[email protected]> wrote:
From: Zi Yan <[email protected]>
With folios support, it is possible to have other than
HPAGE_PMD_ORDERTHPs, in the form of folios, in the system. Usethp_order()to correctly determine the source page order during migration.
Changelog doesn't describe the end user visible effects of the bug. And it really should, because
Quoted 1 line
it fixes a kernel crash!
Zi Yan
reviewerQuoted 8 lines · Andrew Morton
Quoted 5 lines · On Mon, 4 Apr 2022 12:53:25 -0400 Zi Yan <[email protected]> wrote:
From: Zi Yan <[email protected]>
With folios support, it is possible to have other than
HPAGE_PMD_ORDERTHPs, in the form of folios, in the system. Usethp_order()to correctly determine the source page order during migration.
Quoted 6 lines
Changelog doesn't describe the end user visible effects of the bug. And it really should, because
it fixes a kernel crash!
Thank you for adding the information.
--
Best Regards,
Yan, Zi