Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1214648 > unrolled thread

[PATCH 3/3] mm, compaction: disginguish contended status in tracepoint

Started byVlastimil Babka <vbabka@suse.cz>
First post2015-08-27 17:30 +0200
Last post2015-09-08 18:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint Vlastimil Babka <vbabka@suse.cz> - 2015-08-27 17:30 +0200
    Re: [PATCH 3/3] mm, compaction: disginguish contended status in  tracepoint Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2015-09-07 08:00 +0200
      Re: [PATCH 3/3] mm, compaction: disginguish contended status in  tracepoint Vlastimil Babka <vbabka@suse.cz> - 2015-09-08 18:30 +0200

#1214648 — [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint

FromVlastimil Babka <vbabka@suse.cz>
Date2015-08-27 17:30 +0200
Subject[PATCH 3/3] mm, compaction: disginguish contended status in tracepoint
Message-ID<q27hM-8oR-15@gated-at.bofh.it>
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. This patch distinguishes the premature ending
condition. 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>
---
 include/linux/compaction.h        | 1 +
 include/trace/events/compaction.h | 3 ++-
 mm/compaction.c                   | 4 +++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index aa8f61c..50c9580 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -15,6 +15,7 @@
 /* For more detailed tracepoint output */
 #define COMPACT_NO_SUITABLE_PAGE	5
 #define COMPACT_NOT_SUITABLE_ZONE	6
+#define COMPACT_CONTENDED		7
 /* When adding new state, please change compaction_status_string, too */
 
 /* Used to signal whether compaction detected need_sched() or lock contention */
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 8daa8fa..5604994 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -16,7 +16,8 @@
 	EM( COMPACT_PARTIAL,		"partial")		\
 	EM( COMPACT_COMPLETE,		"complete")		\
 	EM( COMPACT_NO_SUITABLE_PAGE,	"no_suitable_page")	\
-	EMe(COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")
+	EM( COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")	\
+	EMe(COMPACT_CONTENDED,		"contended")
 
 #ifdef CONFIG_ZONE_DMA
 #define IFDEF_ZONE_DMA(X) X
diff --git a/mm/compaction.c b/mm/compaction.c
index 7d6ef6e..75a0aca 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1133,7 +1133,7 @@ static int __compact_finished(struct zone *zone, struct compact_control *cc,
 	unsigned long watermark;
 
 	if (cc->contended || fatal_signal_pending(current))
-		return COMPACT_PARTIAL;
+		return COMPACT_CONTENDED;
 
 	/* Compaction run completes if the migrate and free scanner meet */
 	if (cc->free_pfn <= cc->migrate_pfn) {
@@ -1204,6 +1204,8 @@ static int compact_finished(struct zone *zone, struct compact_control *cc,
 	trace_mm_compaction_finished(zone, cc->order, ret);
 	if (ret == COMPACT_NO_SUITABLE_PAGE)
 		ret = COMPACT_CONTINUE;
+	else if (ret == COMPACT_CONTENDED)
+		ret = COMPACT_PARTIAL;
 
 	return ret;
 }
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1219940 — Re: [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint

FromJoonsoo Kim <iamjoonsoo.kim@lge.com>
Date2015-09-07 08:00 +0200
SubjectRe: [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint
Message-ID<q5XDc-56n-15@gated-at.bofh.it>
In reply to#1214648
On Thu, Aug 27, 2015 at 05:24:04PM +0200, Vlastimil Babka wrote:
> 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. This patch distinguishes the premature ending
> condition. Further distinguishing the exact reason seems unnecessary for now.

isolate_migratepages() could return ISOLATE_ABORT and skip to call
compact_finished(). trace_mm_compaction_end() will print
COMPACT_PARTIAL in this case and we cannot distinguish premature
ending condition. Is it okay?

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1220964 — Re: [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint

FromVlastimil Babka <vbabka@suse.cz>
Date2015-09-08 18:30 +0200
SubjectRe: [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint
Message-ID<q6tWr-16N-33@gated-at.bofh.it>
In reply to#1219940
On 09/07/2015 07:53 AM, Joonsoo Kim wrote:
> On Thu, Aug 27, 2015 at 05:24:04PM +0200, Vlastimil Babka wrote:
>> 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. This patch distinguishes the premature ending
>> condition. Further distinguishing the exact reason seems unnecessary for now.
> 
> isolate_migratepages() could return ISOLATE_ABORT and skip to call
> compact_finished(). trace_mm_compaction_end() will print
> COMPACT_PARTIAL in this case and we cannot distinguish premature
> ending condition. Is it okay?

Thanks, that could be indeed misleading. It will affect
trace_mm_compaction_end() which also prints COMPACT_PARTIAL for
COMPACT_CONTENDED case as it's already changed in compact_finished(). And
there's no compaction_finished trace event to clarify. Some cases for abort can
be inferred from trace_mm_compaction_isolate_migratepages, but not all.

Maybe I could move the post-filtering for COMPACT_CONTENDED, now done in
compact_finished() to the end of compact_zone()? That would both enhance also
trace_mm_compaction_end() and allow setting proper "ret" value for the
ISOLATE_ABORT case. The abort only happens for sched contention or
too_many_isolated(), which is basically another form of contention...

> Thanks.
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web