diff options
author | David Rientjes <rientjes@google.com> | 2014-08-28 19:35:05 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-09-26 11:52:00 +0200 |
commit | 0d9b79244228f7ce9d2b2d3a16418a1927669ace (patch) | |
tree | c2280761b235296ee25578e1cd10adc8cadbd270 | |
parent | 812fcdf3758425af5bd8c8ec32ffdb7a9615e00c (diff) |
mm, compaction: terminate async compaction when rescheduling
commit aeef4b83806f49a0c454b7d4578671b71045bee2 upstream.
Async compaction terminates prematurely when need_resched(), see
compact_checklock_irqsave(). This can never trigger, however, if the
cond_resched() in isolate_migratepages_range() always takes care of the
scheduling.
If the cond_resched() actually triggers, then terminate this pageblock
scan for async compaction as well.
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r-- | mm/compaction.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index cebdeca7eacb..4933fded41c1 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -495,8 +495,13 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, return 0; } + if (cond_resched()) { + /* Async terminates prematurely on need_resched() */ + if (cc->mode == MIGRATE_ASYNC) + return 0; + } + /* Time to isolate some pages for migration */ - cond_resched(); for (; low_pfn < end_pfn; low_pfn++) { /* give a chance to irqs before checking need_resched() */ if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) { |