aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2016-10-07 19:57:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 21:46:27 -0400
commitcf378319d335663b6722e74db0211b8af55049d5 (patch)
treee87f81df15b4c322098412bf1bbe7230e8c1b7ab
parent791cae9620e35d18df2cedf2bd444920c3ecf04a (diff)
mm, compaction: rename COMPACT_PARTIAL to COMPACT_SUCCESS
COMPACT_PARTIAL has historically meant that compaction returned after doing some work without fully compacting a zone. It however didn't distinguish if compaction terminated because it succeeded in creating the requested high-order page. This has changed recently and now we only return COMPACT_PARTIAL when compaction thinks it succeeded, or the high-order watermark check in compaction_suitable() passes and no compaction needs to be done. So at this point we can make the return value clearer by renaming it to COMPACT_SUCCESS. The next patch will remove some redundant tests for success where compaction just returned COMPACT_SUCCESS. Link: http://lkml.kernel.org/r/20160810091226.6709-4-vbabka@suse.cz Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Tested-by: Lorenzo Stoakes <lstoakes@gmail.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: David Rientjes <rientjes@google.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/compaction.h8
-rw-r--r--include/trace/events/compaction.h2
-rw-r--r--mm/compaction.c12
-rw-r--r--mm/vmscan.c2
4 files changed, 12 insertions, 12 deletions
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 1bb58581301c..e88c037afe47 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -49,10 +49,10 @@ enum compact_result {
49 COMPACT_CONTENDED, 49 COMPACT_CONTENDED,
50 50
51 /* 51 /*
52 * direct compaction partially compacted a zone and there might be 52 * direct compaction terminated after concluding that the allocation
53 * suitable pages 53 * should now succeed
54 */ 54 */
55 COMPACT_PARTIAL, 55 COMPACT_SUCCESS,
56}; 56};
57 57
58struct alloc_context; /* in mm/internal.h */ 58struct alloc_context; /* in mm/internal.h */
@@ -88,7 +88,7 @@ static inline bool compaction_made_progress(enum compact_result result)
88 * that the compaction successfully isolated and migrated some 88 * that the compaction successfully isolated and migrated some
89 * pageblocks. 89 * pageblocks.
90 */ 90 */
91 if (result == COMPACT_PARTIAL) 91 if (result == COMPACT_SUCCESS)
92 return true; 92 return true;
93 93
94 return false; 94 return false;
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index c2ba402ab256..cbdb90b6b308 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -13,7 +13,7 @@
13 EM( COMPACT_SKIPPED, "skipped") \ 13 EM( COMPACT_SKIPPED, "skipped") \
14 EM( COMPACT_DEFERRED, "deferred") \ 14 EM( COMPACT_DEFERRED, "deferred") \
15 EM( COMPACT_CONTINUE, "continue") \ 15 EM( COMPACT_CONTINUE, "continue") \
16 EM( COMPACT_PARTIAL, "partial") \ 16 EM( COMPACT_SUCCESS, "success") \
17 EM( COMPACT_PARTIAL_SKIPPED, "partial_skipped") \ 17 EM( COMPACT_PARTIAL_SKIPPED, "partial_skipped") \
18 EM( COMPACT_COMPLETE, "complete") \ 18 EM( COMPACT_COMPLETE, "complete") \
19 EM( COMPACT_NO_SUITABLE_PAGE, "no_suitable_page") \ 19 EM( COMPACT_NO_SUITABLE_PAGE, "no_suitable_page") \
diff --git a/mm/compaction.c b/mm/compaction.c
index 8e32778fba5b..335eeeed0c91 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1329,13 +1329,13 @@ static enum compact_result __compact_finished(struct zone *zone, struct compact_
1329 1329
1330 /* Job done if page is free of the right migratetype */ 1330 /* Job done if page is free of the right migratetype */
1331 if (!list_empty(&area->free_list[migratetype])) 1331 if (!list_empty(&area->free_list[migratetype]))
1332 return COMPACT_PARTIAL; 1332 return COMPACT_SUCCESS;
1333 1333
1334#ifdef CONFIG_CMA 1334#ifdef CONFIG_CMA
1335 /* MIGRATE_MOVABLE can fallback on MIGRATE_CMA */ 1335 /* MIGRATE_MOVABLE can fallback on MIGRATE_CMA */
1336 if (migratetype == MIGRATE_MOVABLE && 1336 if (migratetype == MIGRATE_MOVABLE &&
1337 !list_empty(&area->free_list[MIGRATE_CMA])) 1337 !list_empty(&area->free_list[MIGRATE_CMA]))
1338 return COMPACT_PARTIAL; 1338 return COMPACT_SUCCESS;
1339#endif 1339#endif
1340 /* 1340 /*
1341 * Job done if allocation would steal freepages from 1341 * Job done if allocation would steal freepages from
@@ -1343,7 +1343,7 @@ static enum compact_result __compact_finished(struct zone *zone, struct compact_
1343 */ 1343 */
1344 if (find_suitable_fallback(area, order, migratetype, 1344 if (find_suitable_fallback(area, order, migratetype,
1345 true, &can_steal) != -1) 1345 true, &can_steal) != -1)
1346 return COMPACT_PARTIAL; 1346 return COMPACT_SUCCESS;
1347 } 1347 }
1348 1348
1349 return COMPACT_NO_SUITABLE_PAGE; 1349 return COMPACT_NO_SUITABLE_PAGE;
@@ -1367,7 +1367,7 @@ static enum compact_result compact_finished(struct zone *zone,
1367 * compaction_suitable: Is this suitable to run compaction on this zone now? 1367 * compaction_suitable: Is this suitable to run compaction on this zone now?
1368 * Returns 1368 * Returns
1369 * COMPACT_SKIPPED - If there are too few free pages for compaction 1369 * COMPACT_SKIPPED - If there are too few free pages for compaction
1370 * COMPACT_PARTIAL - If the allocation would succeed without compaction 1370 * COMPACT_SUCCESS - If the allocation would succeed without compaction
1371 * COMPACT_CONTINUE - If compaction should run now 1371 * COMPACT_CONTINUE - If compaction should run now
1372 */ 1372 */
1373static enum compact_result __compaction_suitable(struct zone *zone, int order, 1373static enum compact_result __compaction_suitable(struct zone *zone, int order,
@@ -1388,7 +1388,7 @@ static enum compact_result __compaction_suitable(struct zone *zone, int order,
1388 */ 1388 */
1389 if (zone_watermark_ok(zone, order, watermark, classzone_idx, 1389 if (zone_watermark_ok(zone, order, watermark, classzone_idx,
1390 alloc_flags)) 1390 alloc_flags))
1391 return COMPACT_PARTIAL; 1391 return COMPACT_SUCCESS;
1392 1392
1393 /* 1393 /*
1394 * Watermarks for order-0 must be met for compaction. Note the 2UL. 1394 * Watermarks for order-0 must be met for compaction. Note the 2UL.
@@ -1477,7 +1477,7 @@ static enum compact_result compact_zone(struct zone *zone, struct compact_contro
1477 ret = compaction_suitable(zone, cc->order, cc->alloc_flags, 1477 ret = compaction_suitable(zone, cc->order, cc->alloc_flags,
1478 cc->classzone_idx); 1478 cc->classzone_idx);
1479 /* Compaction is likely to fail */ 1479 /* Compaction is likely to fail */
1480 if (ret == COMPACT_PARTIAL || ret == COMPACT_SKIPPED) 1480 if (ret == COMPACT_SUCCESS || ret == COMPACT_SKIPPED)
1481 return ret; 1481 return ret;
1482 1482
1483 /* huh, compaction_suitable is returning something unexpected */ 1483 /* huh, compaction_suitable is returning something unexpected */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0fe8b7113868..981fc84e7434 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2495,7 +2495,7 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat,
2495 continue; 2495 continue;
2496 2496
2497 switch (compaction_suitable(zone, sc->order, 0, sc->reclaim_idx)) { 2497 switch (compaction_suitable(zone, sc->order, 0, sc->reclaim_idx)) {
2498 case COMPACT_PARTIAL: 2498 case COMPACT_SUCCESS:
2499 case COMPACT_CONTINUE: 2499 case COMPACT_CONTINUE:
2500 return false; 2500 return false;
2501 default: 2501 default: