From ea1cdbd8384e07578b53aa83148d2570b489d6ad Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Wed, 26 Sep 2012 11:33:49 +1000 Subject: [PATCH] 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 --- mm/compaction.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; } -- 2.39.5