From: Mel Gorman Date: Fri, 28 Sep 2012 00:19:44 +0000 (+1000) Subject: mm-compaction-abort-compaction-loop-if-lock-is-contended-or-run-too-long-fix-2 X-Git-Tag: next-20120928~1^2~246 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f13f418093800d075c20c44b434b82c65dd84143;p=karo-tx-linux.git mm-compaction-abort-compaction-loop-if-lock-is-contended-or-run-too-long-fix-2 o Fix BUG_ON triggered due to pages left on cc.migratepages o Make compact_zone_order() require non-NULL arg `contended' [minchan@kernel.org: Putback pages isolated for migration if aborting] [akpm@linux-foundation.org: compact_zone_order requires non-NULL arg contended] Signed-off-by: Andrea Arcangeli Signed-off-by: Shaohua Li Signed-off-by: Mel Gorman Signed-off-by: Andrew Morton --- diff --git a/mm/compaction.c b/mm/compaction.c index 7c3bd79b3310..0649cc1b3479 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -847,6 +847,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) switch (isolate_migratepages(zone, cc)) { case ISOLATE_ABORT: ret = COMPACT_PARTIAL; + putback_lru_pages(&cc->migratepages); + cc->nr_migratepages = 0; goto out; case ISOLATE_NONE: continue; @@ -909,6 +911,10 @@ static unsigned long compact_zone_order(struct zone *zone, INIT_LIST_HEAD(&cc.migratepages); ret = compact_zone(zone, &cc); + + VM_BUG_ON(!list_empty(&cc.freepages)); + VM_BUG_ON(!list_empty(&cc.migratepages)); + *contended = cc.contended; return ret; }