提交 767185c9 编写于 作者: M Mel Gorman 提交者: Shile Zhang

mm, compaction: check early for huge pages encountered by the migration scanner

to #26255339

commit 9bebefd59084af7c75b66eeee241bf0777f39b88 upstream

When scanning for sources or targets, PageCompound is checked for huge
pages as they can be skipped quickly but it happens relatively late
after a lot of setup and checking.  This patch short-cuts the check to
make it earlier.  It might still change when the lock is acquired but
this has less overhead overall.  The free scanner advances but the
migration scanner does not.  Typically the free scanner encounters more
movable blocks that change state over the lifetime of the system and
also tends to scan more aggressively as it's actively filling its
portion of the physical address space with data.  This could change in
the future but for the moment, this worked better in practice and
incurred fewer scan restarts.

The impact on latency and allocation success rates is marginal but the
free scan rates are reduced by 15% and system CPU usage is reduced by
3.3%.  The 2-socket results are not materially different.

Link: http://lkml.kernel.org/r/20190118175136.31341-15-mgorman@techsingularity.netSigned-off-by: NMel Gorman <mgorman@techsingularity.net>
Acked-by: NVlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: David Rientjes <rientjes@google.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NYang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 4bfbd121
......@@ -1061,6 +1061,9 @@ static bool suitable_migration_source(struct compact_control *cc,
{
int block_mt;
if (pageblock_skip_persistent(page))
return false;
if ((cc->mode != MIGRATE_ASYNC) || !cc->direct_compaction)
return true;
......@@ -1697,12 +1700,17 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
continue;
/*
* For async compaction, also only scan in MOVABLE blocks.
* Async compaction is optimistic to see if the minimum amount
* of work satisfies the allocation.
* For async compaction, also only scan in MOVABLE blocks
* without huge pages. Async compaction is optimistic to see
* if the minimum amount of work satisfies the allocation.
* The cached PFN is updated as it's possible that all
* remaining blocks between source and target are unsuitable
* and the compaction scanners fail to meet.
*/
if (!suitable_migration_source(cc, page))
if (!suitable_migration_source(cc, page)) {
update_cached_migrate(cc, block_end_pfn);
continue;
}
/* Perform the isolation */
low_pfn = isolate_migratepages_block(cc, low_pfn,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册