diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2015-11-05 21:48:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-05 22:34:48 -0500 |
commit | 2d1e10412c2388ff9b6afc60536eaa195a419289 (patch) | |
tree | b1a4d9b145a9c4442e51141b9fa17d25d8fa90fb /mm/compaction.c | |
parent | 1743d0506003f7db0602d120ecf63e2747af0d72 (diff) |
mm, compaction: distinguish contended status in tracepoints
Compaction returns prematurely with COMPACT_PARTIAL when contended or has
fatal signal pending. This is ok for the callers, but might be misleading
in the traces, as the usual reason to return COMPACT_PARTIAL is that we
think the allocation should succeed. After this patch we distinguish the
premature ending condition in the mm_compaction_finished and
mm_compaction_end tracepoints.
The contended status covers the following reasons:
- lock contention or need_resched() detected in async compaction
- fatal signal pending
- too many pages isolated in the zone (only for async compaction)
Further distinguishing the exact reason seems unnecessary for now.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.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 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index a5849c442a57..de3e1e71cd9f 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -1202,7 +1202,7 @@ static int __compact_finished(struct zone *zone, struct compact_control *cc, | |||
1202 | unsigned long watermark; | 1202 | unsigned long watermark; |
1203 | 1203 | ||
1204 | if (cc->contended || fatal_signal_pending(current)) | 1204 | if (cc->contended || fatal_signal_pending(current)) |
1205 | return COMPACT_PARTIAL; | 1205 | return COMPACT_CONTENDED; |
1206 | 1206 | ||
1207 | /* Compaction run completes if the migrate and free scanner meet */ | 1207 | /* Compaction run completes if the migrate and free scanner meet */ |
1208 | if (compact_scanners_met(cc)) { | 1208 | if (compact_scanners_met(cc)) { |
@@ -1393,7 +1393,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) | |||
1393 | 1393 | ||
1394 | switch (isolate_migratepages(zone, cc)) { | 1394 | switch (isolate_migratepages(zone, cc)) { |
1395 | case ISOLATE_ABORT: | 1395 | case ISOLATE_ABORT: |
1396 | ret = COMPACT_PARTIAL; | 1396 | ret = COMPACT_CONTENDED; |
1397 | putback_movable_pages(&cc->migratepages); | 1397 | putback_movable_pages(&cc->migratepages); |
1398 | cc->nr_migratepages = 0; | 1398 | cc->nr_migratepages = 0; |
1399 | goto out; | 1399 | goto out; |
@@ -1424,7 +1424,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) | |||
1424 | * and we want compact_finished() to detect it | 1424 | * and we want compact_finished() to detect it |
1425 | */ | 1425 | */ |
1426 | if (err == -ENOMEM && !compact_scanners_met(cc)) { | 1426 | if (err == -ENOMEM && !compact_scanners_met(cc)) { |
1427 | ret = COMPACT_PARTIAL; | 1427 | ret = COMPACT_CONTENDED; |
1428 | goto out; | 1428 | goto out; |
1429 | } | 1429 | } |
1430 | } | 1430 | } |
@@ -1477,6 +1477,9 @@ out: | |||
1477 | trace_mm_compaction_end(start_pfn, cc->migrate_pfn, | 1477 | trace_mm_compaction_end(start_pfn, cc->migrate_pfn, |
1478 | cc->free_pfn, end_pfn, sync, ret); | 1478 | cc->free_pfn, end_pfn, sync, ret); |
1479 | 1479 | ||
1480 | if (ret == COMPACT_CONTENDED) | ||
1481 | ret = COMPACT_PARTIAL; | ||
1482 | |||
1480 | return ret; | 1483 | return ret; |
1481 | } | 1484 | } |
1482 | 1485 | ||