mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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/[email protected] Signed-off-by: Vlastimil Babka <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
d39773a062
commit
282722b0d2
2 changed files with 22 additions and 9 deletions
|
|
@ -986,10 +986,17 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn,
|
|||
static bool suitable_migration_source(struct compact_control *cc,
|
||||
struct page *page)
|
||||
{
|
||||
if (cc->mode != MIGRATE_ASYNC)
|
||||
int block_mt;
|
||||
|
||||
if ((cc->mode != MIGRATE_ASYNC) || !cc->direct_compaction)
|
||||
return true;
|
||||
|
||||
return is_migrate_movable(get_pageblock_migratetype(page));
|
||||
block_mt = get_pageblock_migratetype(page);
|
||||
|
||||
if (cc->migratetype == MIGRATE_MOVABLE)
|
||||
return is_migrate_movable(block_mt);
|
||||
else
|
||||
return block_mt == cc->migratetype;
|
||||
}
|
||||
|
||||
/* Returns true if the page is within a block suitable for migration to */
|
||||
|
|
|
|||
Loading…
Reference in a new issue