summaryrefslogtreecommitdiffstats
path: root/mm/compaction.c
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2016-05-20 19:56:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-20 20:58:30 -0400
commitc46649deae3f00aa8ba8716f0ddb8eef2dc9532f (patch)
tree2a8ff1f7a5ce9bcb95abed9ed99fd07c72941774 /mm/compaction.c
parentea7ab982b6bdb7ce218fd3a7850bb2e2b414fdd0 (diff)
mm, compaction: cover all compaction mode in compact_zone
The compiler is complaining after "mm, compaction: change COMPACT_ constants into enum" mm/compaction.c: In function `compact_zone': mm/compaction.c:1350:2: warning: enumeration value `COMPACT_DEFERRED' not handled in switch [-Wswitch] switch (ret) { ^ mm/compaction.c:1350:2: warning: enumeration value `COMPACT_COMPLETE' not handled in switch [-Wswitch] mm/compaction.c:1350:2: warning: enumeration value `COMPACT_NO_SUITABLE_PAGE' not handled in switch [-Wswitch] mm/compaction.c:1350:2: warning: enumeration value `COMPACT_NOT_SUITABLE_ZONE' not handled in switch [-Wswitch] mm/compaction.c:1350:2: warning: enumeration value `COMPACT_CONTENDED' not handled in switch [-Wswitch] compaction_suitable is allowed to return only COMPACT_PARTIAL, COMPACT_SKIPPED and COMPACT_CONTINUE so other cases are simply impossible. Put a VM_BUG_ON to catch an impossible return value. Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com> Cc: David Rientjes <rientjes@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Joonsoo Kim <js1304@gmail.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Vladimir Davydov <vdavydov@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r--mm/compaction.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/mm/compaction.c b/mm/compaction.c
index e721d252c5d2..455ecd87f48d 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1383,15 +1383,12 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro
1383 1383
1384 ret = compaction_suitable(zone, cc->order, cc->alloc_flags, 1384 ret = compaction_suitable(zone, cc->order, cc->alloc_flags,
1385 cc->classzone_idx); 1385 cc->classzone_idx);
1386 switch (ret) { 1386 /* Compaction is likely to fail */
1387 case COMPACT_PARTIAL: 1387 if (ret == COMPACT_PARTIAL || ret == COMPACT_SKIPPED)
1388 case COMPACT_SKIPPED:
1389 /* Compaction is likely to fail */
1390 return ret; 1388 return ret;
1391 case COMPACT_CONTINUE: 1389
1392 /* Fall through to compaction */ 1390 /* huh, compaction_suitable is returning something unexpected */
1393 ; 1391 VM_BUG_ON(ret != COMPACT_CONTINUE);
1394 }
1395 1392
1396 /* 1393 /*
1397 * Clear pageblock skip if there were failures recently and compaction 1394 * Clear pageblock skip if there were failures recently and compaction