History

mm/migrate: clear __GFP_RECLAIM to make the migration callback consistent with regular THP allocations

new_page_nodemask is a migration callback and it tries to use a common gfp flags for the target page allocation whether it is a base page or a THP. The later only adds GFP_TRANSHUGE to the given mask. This results in the allocation being slightly more aggressive than necessary because the resulting gfp mask will contain also __GFP_RECLAIM_KSWAPD. THP allocations usually exclude this flag to reduce over eager background reclaim during a high THP allocation load which has been seen during large mmaps initialization. There is no indication that this is a problem for migration as well but theoretically the same might happen when migrating large mappings to a different node. Make the migration callback consistent with regular THP allocations. [akpm@linux-foundation.org: fix comment typo, per Vlastimil]

Joonsoo Kim committed 6 years ago

Commit 9933a0c1 parent d92bbc21 file · +5 −0Browse files

Unified · Split

mm/migrate.c+5−0
@@ -1554,6 +1554,11 @@ struct page *new_page_nodemask(struct page *page, · 1553 unmodified lines
1554 }1554 }
1555 1555
1556 if (PageTransHuge(page)) {1556 if (PageTransHuge(page)) {
1557 /*
1558 * clear __GFP_RECLAIM to make the migration callback
1559 * consistent with regular THP allocations.
1560 */
1561 gfp_mask &= ~__GFP_RECLAIM;
1557 gfp_mask |= GFP_TRANSHUGE;1562 gfp_mask |= GFP_TRANSHUGE;
1558 order = HPAGE_PMD_ORDER;1563 order = HPAGE_PMD_ORDER;
1559 }1564 }