aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2014-06-04 19:08:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:07 -0400
commitaeef4b83806f49a0c454b7d4578671b71045bee2 (patch)
treec599f3139026f7d674f99824f80625bd5328ad8c
parent75f30861a12a6b09b759dfeeb9290b681af89057 (diff)
mm, compaction: terminate async compaction when rescheduling
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>
-rw-r--r--mm/compaction.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index 217a6ad9a20e..56331f5124ba 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -494,8 +494,13 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
494 return 0; 494 return 0;
495 } 495 }
496 496
497 if (cond_resched()) {
498 /* Async terminates prematurely on need_resched() */
499 if (cc->mode == MIGRATE_ASYNC)
500 return 0;
501 }
502
497 /* Time to isolate some pages for migration */ 503 /* Time to isolate some pages for migration */
498 cond_resched();
499 for (; low_pfn < end_pfn; low_pfn++) { 504 for (; low_pfn < end_pfn; low_pfn++) {
500 /* give a chance to irqs before checking need_resched() */ 505 /* give a chance to irqs before checking need_resched() */
501 if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) { 506 if (locked && !(low_pfn % SWAP_CLUSTER_MAX)) {