]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm, compaction: terminate async compaction when rescheduling
authorDavid Rientjes <rientjes@google.com>
Thu, 22 May 2014 00:43:13 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:13 +0000 (10:43 +1000)
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>
mm/compaction.c

index 8440786c39a6b72fa51b285d60b1bc1e4a506d6b..6f4b218e898a9a2d0ce6741a2e70a5b70afa240d 100644 (file)
@@ -491,8 +491,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)) {