diff options
author | Yaowei Bai <bywxiaobai@163.com> | 2015-11-05 21:47:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-05 22:34:48 -0500 |
commit | 21c527a3cba07f9a9ce17b3a445f110a847793e2 (patch) | |
tree | a87e5607b438dce4fce6c1cc49a6759d37e38712 /mm/compaction.c | |
parent | 29d06bbb41595f82db309a5516426ef8bd0f27b7 (diff) |
mm/compaction.c: add an is_via_compact_memory() helper
Introduce is_via_compact_memory() helper indicating compacting via
/proc/sys/vm/compact_memory to improve readability.
To catch this situation in __compaction_suitable, use order as parameter
directly instead of using struct compact_control.
This patch has no functional changes.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Acked-by: David Rientjes <rientjes@google.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.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index c5c627aae996..a8e659398fdf 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -1197,6 +1197,15 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, | |||
1197 | return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; | 1197 | return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | /* | ||
1201 | * order == -1 is expected when compacting via | ||
1202 | * /proc/sys/vm/compact_memory | ||
1203 | */ | ||
1204 | static inline bool is_via_compact_memory(int order) | ||
1205 | { | ||
1206 | return order == -1; | ||
1207 | } | ||
1208 | |||
1200 | static int __compact_finished(struct zone *zone, struct compact_control *cc, | 1209 | static int __compact_finished(struct zone *zone, struct compact_control *cc, |
1201 | const int migratetype) | 1210 | const int migratetype) |
1202 | { | 1211 | { |
@@ -1223,11 +1232,7 @@ static int __compact_finished(struct zone *zone, struct compact_control *cc, | |||
1223 | return COMPACT_COMPLETE; | 1232 | return COMPACT_COMPLETE; |
1224 | } | 1233 | } |
1225 | 1234 | ||
1226 | /* | 1235 | if (is_via_compact_memory(cc->order)) |
1227 | * order == -1 is expected when compacting via | ||
1228 | * /proc/sys/vm/compact_memory | ||
1229 | */ | ||
1230 | if (cc->order == -1) | ||
1231 | return COMPACT_CONTINUE; | 1236 | return COMPACT_CONTINUE; |
1232 | 1237 | ||
1233 | /* Compaction run is not finished if the watermark is not met */ | 1238 | /* Compaction run is not finished if the watermark is not met */ |
@@ -1290,11 +1295,7 @@ static unsigned long __compaction_suitable(struct zone *zone, int order, | |||
1290 | int fragindex; | 1295 | int fragindex; |
1291 | unsigned long watermark; | 1296 | unsigned long watermark; |
1292 | 1297 | ||
1293 | /* | 1298 | if (is_via_compact_memory(order)) |
1294 | * order == -1 is expected when compacting via | ||
1295 | * /proc/sys/vm/compact_memory | ||
1296 | */ | ||
1297 | if (order == -1) | ||
1298 | return COMPACT_CONTINUE; | 1299 | return COMPACT_CONTINUE; |
1299 | 1300 | ||
1300 | watermark = low_wmark_pages(zone); | 1301 | watermark = low_wmark_pages(zone); |
@@ -1658,10 +1659,11 @@ static void __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc) | |||
1658 | * this makes sure we compact the whole zone regardless of | 1659 | * this makes sure we compact the whole zone regardless of |
1659 | * cached scanner positions. | 1660 | * cached scanner positions. |
1660 | */ | 1661 | */ |
1661 | if (cc->order == -1) | 1662 | if (is_via_compact_memory(cc->order)) |
1662 | __reset_isolation_suitable(zone); | 1663 | __reset_isolation_suitable(zone); |
1663 | 1664 | ||
1664 | if (cc->order == -1 || !compaction_deferred(zone, cc->order)) | 1665 | if (is_via_compact_memory(cc->order) || |
1666 | !compaction_deferred(zone, cc->order)) | ||
1665 | compact_zone(zone, cc); | 1667 | compact_zone(zone, cc); |
1666 | 1668 | ||
1667 | if (cc->order > 0) { | 1669 | if (cc->order > 0) { |