diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2017-05-08 18:54:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-08 20:15:10 -0400 |
commit | 282722b0d258ec23fc79d80165418fee83f01736 (patch) | |
tree | 01b33534bae259a2ad1ce7acf98e5b5632bb467b /mm/compaction.c | |
parent | d39773a0622c267fef3f79e3b1f0e7bdbad8a1a8 (diff) |
mm, compaction: restrict async compaction to pageblocks of same migratetype
The migrate scanner in async compaction is currently limited to
MIGRATE_MOVABLE pageblocks. This is a heuristic intended to reduce
latency, based on the assumption that non-MOVABLE pageblocks are
unlikely to contain movable pages.
However, with the exception of THP's, most high-order allocations are
not movable. Should the async compaction succeed, this increases the
chance that the non-MOVABLE allocations will fallback to a MOVABLE
pageblock, making the long-term fragmentation worse.
This patch attempts to help the situation by changing async direct
compaction so that the migrate scanner only scans the pageblocks of the
requested migratetype. If it's a non-MOVABLE type and there are such
pageblocks that do contain movable pages, chances are that the
allocation can succeed within one of such pageblocks, removing the need
for a fallback. If that fails, the subsequent sync attempt will ignore
this restriction.
In testing based on 4.9 kernel with stress-highalloc from mmtests
configured for order-4 GFP_KERNEL allocations, this patch has reduced
the number of unmovable allocations falling back to movable pageblocks
by 30%. The number of movable allocations falling back is reduced by
12%.
Link: http://lkml.kernel.org/r/20170307131545.28577-8-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 365b3c8ae943..206847d35978 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -986,10 +986,17 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, | |||
986 | static bool suitable_migration_source(struct compact_control *cc, | 986 | static bool suitable_migration_source(struct compact_control *cc, |
987 | struct page *page) | 987 | struct page *page) |
988 | { | 988 | { |
989 | if (cc->mode != MIGRATE_ASYNC) | 989 | int block_mt; |
990 | |||
991 | if ((cc->mode != MIGRATE_ASYNC) || !cc->direct_compaction) | ||
990 | return true; | 992 | return true; |
991 | 993 | ||
992 | return is_migrate_movable(get_pageblock_migratetype(page)); | 994 | block_mt = get_pageblock_migratetype(page); |
995 | |||
996 | if (cc->migratetype == MIGRATE_MOVABLE) | ||
997 | return is_migrate_movable(block_mt); | ||
998 | else | ||
999 | return block_mt == cc->migratetype; | ||
993 | } | 1000 | } |
994 | 1001 | ||
995 | /* Returns true if the page is within a block suitable for migration to */ | 1002 | /* Returns true if the page is within a block suitable for migration to */ |