summaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>2020-08-11 18:37:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-08-12 10:58:02 -0700
commit9933a0c8a5396df6dbaef809a9ee4ad64ebc3abe (patch)
tree9eeae019998d23d566f69af2f2cc8b52e22439a1 /mm/migrate.c
parentd92bbc2719bd2be237ee336113b63492a6baca3b (diff)
downloadlinux-stable-9933a0c8a5396df6dbaef809a9ee4ad64ebc3abe.tar.gz
linux-stable-9933a0c8a5396df6dbaef809a9ee4ad64ebc3abe.tar.bz2
linux-stable-9933a0c8a5396df6dbaef809a9ee4ad64ebc3abe.zip
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] Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Christoph Hellwig <hch@infradead.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Roman Gushchin <guro@fb.com> Link: http://lkml.kernel.org/r/1594622517-20681-5-git-send-email-iamjoonsoo.kim@lge.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 8d084e9bc13b..46cca5c2ebff 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1554,6 +1554,11 @@ struct page *new_page_nodemask(struct page *page,
}
if (PageTransHuge(page)) {
+ /*
+ * clear __GFP_RECLAIM to make the migration callback
+ * consistent with regular THP allocations.
+ */
+ gfp_mask &= ~__GFP_RECLAIM;
gfp_mask |= GFP_TRANSHUGE;
order = HPAGE_PMD_ORDER;
}