From: David Rientjes Date: Wed, 4 Jun 2014 23:08:31 +0000 (-0700) Subject: mm, compaction: terminate async compaction when rescheduling X-Git-Tag: upstream/snapshot3+hdmi~17^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c99371f2bd5a31e66b8199c3e66629043d98a6c;hp=102a623045f715b79f9e4ad697c3f413506d6378;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Acked-by: Mel Gorman Acked-by: Vlastimil Babka Cc: Mel Gorman Cc: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Mel Gorman Signed-off-by: Greg Kroah-Hartman --- diff --git a/mm/compaction.c b/mm/compaction.c index 3c39e5b..4d38c85 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -494,8 +494,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)) {