linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace
@ 2015-08-27 15:24 Vlastimil Babka
  2015-08-27 15:24 ` [PATCH 2/3] mm, compaction: export tracepoints zone names " Vlastimil Babka
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Vlastimil Babka @ 2015-08-27 15:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-mm, Vlastimil Babka, Joonsoo Kim,
	Steven Rostedt, Ingo Molnar, Mel Gorman, David Rientjes

Some compaction tracepoints convert the integer return values to strings using
the compaction_status_string array. This works for in-kernel printing, but not
userspace trace printing of raw captured trace such as via trace-cmd report.

This patch converts the private array to appropriate tracepoint macros that
result in proper userspace support.

trace-cmd output before:
transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
  zone=ffffffff81815d7a order=9 ret=

after:
transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
  zone=ffffffff81815d7a order=9 ret=partial

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
---
 include/trace/events/compaction.h | 33 +++++++++++++++++++++++++++++++--
 mm/compaction.c                   | 11 -----------
 2 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 9a6a3fe..1275a55 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -9,6 +9,35 @@
 #include <linux/tracepoint.h>
 #include <trace/events/gfpflags.h>
 
+#define COMPACTION_STATUS					\
+	EM( COMPACT_DEFERRED,		"deferred")		\
+	EM( COMPACT_SKIPPED,		"skipped")		\
+	EM( COMPACT_CONTINUE,		"continue")		\
+	EM( COMPACT_PARTIAL,		"partial")		\
+	EM( COMPACT_COMPLETE,		"complete")		\
+	EM( COMPACT_NO_SUITABLE_PAGE,	"no_suitable_page")	\
+	EMe(COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")
+
+/*
+ * First define the enums in the above macros to be exported to userspace
+ * via TRACE_DEFINE_ENUM().
+ */
+#undef EM
+#undef EMe
+#define EM(a, b)	TRACE_DEFINE_ENUM(a);
+#define EMe(a, b)	TRACE_DEFINE_ENUM(a);
+
+COMPACTION_STATUS
+
+/*
+ * Now redefine the EM() and EMe() macros to map the enums to the strings
+ * that will be printed in the output.
+ */
+#undef EM
+#undef EMe
+#define EM(a, b)	{a, b},
+#define EMe(a, b)	{a, b}
+
 DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
 
 	TP_PROTO(
@@ -161,7 +190,7 @@ TRACE_EVENT(mm_compaction_end,
 		__entry->free_pfn,
 		__entry->zone_end,
 		__entry->sync ? "sync" : "async",
-		compaction_status_string[__entry->status])
+		__print_symbolic(__entry->status, COMPACTION_STATUS))
 );
 
 TRACE_EVENT(mm_compaction_try_to_compact_pages,
@@ -217,7 +246,7 @@ DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
 		__entry->nid,
 		__entry->name,
 		__entry->order,
-		compaction_status_string[__entry->ret])
+		__print_symbolic(__entry->ret, COMPACTION_STATUS))
 );
 
 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished,
diff --git a/mm/compaction.c b/mm/compaction.c
index 018f08d..7d6ef6e 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -35,17 +35,6 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
 #endif
 
 #if defined CONFIG_COMPACTION || defined CONFIG_CMA
-#ifdef CONFIG_TRACEPOINTS
-static const char *const compaction_status_string[] = {
-	"deferred",
-	"skipped",
-	"continue",
-	"partial",
-	"complete",
-	"no_suitable_page",
-	"not_suitable_zone",
-};
-#endif
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/compaction.h>
-- 
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] mm, compaction: export tracepoints zone names to userspace
  2015-08-27 15:24 [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Vlastimil Babka
@ 2015-08-27 15:24 ` Vlastimil Babka
  2015-08-31 14:58   ` Steven Rostedt
  2015-08-31 15:32   ` Steven Rostedt
  2015-08-27 15:24 ` [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint Vlastimil Babka
  2015-08-31 14:55 ` [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Steven Rostedt
  2 siblings, 2 replies; 11+ messages in thread
From: Vlastimil Babka @ 2015-08-27 15:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-mm, Vlastimil Babka, Joonsoo Kim,
	Steven Rostedt, Ingo Molnar, Mel Gorman, David Rientjes

Some compaction tracepoints use zone->name to print which zone is being
compacted. This works for in-kernel printing, but not userspace trace printing
of raw captured trace such as via trace-cmd report.

This patch uses zone_idx() instead of zone->name as the raw value, and when
printing, converts the zone_type to string using the appropriate EM() macros
and some ugly tricks to overcome the problem that half the values depend on
CONFIG_ options and one does not simply use #ifdef inside of #define.

trace-cmd output before:
transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
zone=ffffffff81815d7a order=9 ret=partial

after:
transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
zone=Normal   order=9 ret=partial

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
---
 include/trace/events/compaction.h | 38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 1275a55..8daa8fa 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -18,6 +18,31 @@
 	EM( COMPACT_NO_SUITABLE_PAGE,	"no_suitable_page")	\
 	EMe(COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")
 
+#ifdef CONFIG_ZONE_DMA
+#define IFDEF_ZONE_DMA(X) X
+#else
+#define IFDEF_ZONE_DMA(X)
+#endif
+
+#ifdef CONFIG_ZONE_DMA32
+#define IFDEF_ZONE_DMA32(X) X
+#else
+#define IFDEF_ZONE_DMA32(X)
+#endif
+
+#ifdef CONFIG_ZONE_HIGHMEM_
+#define IFDEF_ZONE_HIGHMEM(X) X
+#else
+#define IFDEF_ZONE_HIGHMEM(X)
+#endif
+
+#define ZONE_TYPE						\
+	IFDEF_ZONE_DMA(		EM (ZONE_DMA,	 "DMA"))	\
+	IFDEF_ZONE_DMA32(	EM (ZONE_DMA32,	 "DMA32"))	\
+				EM (ZONE_NORMAL, "Normal")	\
+	IFDEF_ZONE_HIGHMEM(	EM (ZONE_HIGHMEM,"HighMem"))	\
+				EMe(ZONE_MOVABLE,"Movable")
+
 /*
  * First define the enums in the above macros to be exported to userspace
  * via TRACE_DEFINE_ENUM().
@@ -28,6 +53,7 @@
 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
 
 COMPACTION_STATUS
+ZONE_TYPE
 
 /*
  * Now redefine the EM() and EMe() macros to map the enums to the strings
@@ -230,21 +256,21 @@ DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
 
 	TP_STRUCT__entry(
 		__field(int, nid)
-		__field(char *, name)
+		__field(enum zone_type, idx)
 		__field(int, order)
 		__field(int, ret)
 	),
 
 	TP_fast_assign(
 		__entry->nid = zone_to_nid(zone);
-		__entry->name = (char *)zone->name;
+		__entry->idx = zone_idx(zone);
 		__entry->order = order;
 		__entry->ret = ret;
 	),
 
 	TP_printk("node=%d zone=%-8s order=%d ret=%s",
 		__entry->nid,
-		__entry->name,
+		__print_symbolic(__entry->idx, ZONE_TYPE),
 		__entry->order,
 		__print_symbolic(__entry->ret, COMPACTION_STATUS))
 );
@@ -276,7 +302,7 @@ DECLARE_EVENT_CLASS(mm_compaction_defer_template,
 
 	TP_STRUCT__entry(
 		__field(int, nid)
-		__field(char *, name)
+		__field(enum zone_type, idx)
 		__field(int, order)
 		__field(unsigned int, considered)
 		__field(unsigned int, defer_shift)
@@ -285,7 +311,7 @@ DECLARE_EVENT_CLASS(mm_compaction_defer_template,
 
 	TP_fast_assign(
 		__entry->nid = zone_to_nid(zone);
-		__entry->name = (char *)zone->name;
+		__entry->idx = zone_idx(zone);
 		__entry->order = order;
 		__entry->considered = zone->compact_considered;
 		__entry->defer_shift = zone->compact_defer_shift;
@@ -294,7 +320,7 @@ DECLARE_EVENT_CLASS(mm_compaction_defer_template,
 
 	TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu",
 		__entry->nid,
-		__entry->name,
+		__print_symbolic(__entry->idx, ZONE_TYPE),
 		__entry->order,
 		__entry->order_failed,
 		__entry->considered,
-- 
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint
  2015-08-27 15:24 [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Vlastimil Babka
  2015-08-27 15:24 ` [PATCH 2/3] mm, compaction: export tracepoints zone names " Vlastimil Babka
@ 2015-08-27 15:24 ` Vlastimil Babka
  2015-09-07  5:53   ` Joonsoo Kim
  2015-08-31 14:55 ` [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Steven Rostedt
  2 siblings, 1 reply; 11+ messages in thread
From: Vlastimil Babka @ 2015-08-27 15:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-mm, Vlastimil Babka, Joonsoo Kim, Mel Gorman,
	David Rientjes

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace
  2015-08-27 15:24 [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Vlastimil Babka
  2015-08-27 15:24 ` [PATCH 2/3] mm, compaction: export tracepoints zone names " Vlastimil Babka
  2015-08-27 15:24 ` [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint Vlastimil Babka
@ 2015-08-31 14:55 ` Steven Rostedt
  2015-08-31 15:27   ` Vlastimil Babka
  2 siblings, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2015-08-31 14:55 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-kernel, linux-mm, Joonsoo Kim, Ingo Molnar,
	Mel Gorman, David Rientjes

On Thu, 27 Aug 2015 17:24:02 +0200
Vlastimil Babka <vbabka@suse.cz> wrote:

> Some compaction tracepoints convert the integer return values to strings using
> the compaction_status_string array. This works for in-kernel printing, but not
> userspace trace printing of raw captured trace such as via trace-cmd report.
> 
> This patch converts the private array to appropriate tracepoint macros that
> result in proper userspace support.
> 
> trace-cmd output before:
> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
>   zone=ffffffff81815d7a order=9 ret=
> 
> after:
> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
>   zone=ffffffff81815d7a order=9 ret=partial
> 

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: David Rientjes <rientjes@google.com>
> ---
>  include/trace/events/compaction.h | 33 +++++++++++++++++++++++++++++++--
>  mm/compaction.c                   | 11 -----------
>  2 files changed, 31 insertions(+), 13 deletions(-)
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] mm, compaction: export tracepoints zone names to userspace
  2015-08-27 15:24 ` [PATCH 2/3] mm, compaction: export tracepoints zone names " Vlastimil Babka
@ 2015-08-31 14:58   ` Steven Rostedt
  2015-08-31 15:02     ` Vlastimil Babka
  2015-08-31 15:32   ` Steven Rostedt
  1 sibling, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2015-08-31 14:58 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-kernel, linux-mm, Joonsoo Kim, Ingo Molnar,
	Mel Gorman, David Rientjes

On Thu, 27 Aug 2015 17:24:03 +0200
Vlastimil Babka <vbabka@suse.cz> wrote:

> Some compaction tracepoints use zone->name to print which zone is being
> compacted. This works for in-kernel printing, but not userspace trace printing
> of raw captured trace such as via trace-cmd report.
> 
> This patch uses zone_idx() instead of zone->name as the raw value, and when
> printing, converts the zone_type to string using the appropriate EM() macros
> and some ugly tricks to overcome the problem that half the values depend on
> CONFIG_ options and one does not simply use #ifdef inside of #define.
> 
> trace-cmd output before:
> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
> zone=ffffffff81815d7a order=9 ret=partial
> 
> after:
> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
> zone=Normal   order=9 ret=partial
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: David Rientjes <rientjes@google.com>
> ---
>  include/trace/events/compaction.h | 38 ++++++++++++++++++++++++++++++++------
>  1 file changed, 32 insertions(+), 6 deletions(-)
> 
> diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
> index 1275a55..8daa8fa 100644
> --- a/include/trace/events/compaction.h
> +++ b/include/trace/events/compaction.h
> @@ -18,6 +18,31 @@
>  	EM( COMPACT_NO_SUITABLE_PAGE,	"no_suitable_page")	\
>  	EMe(COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")
>  
> +#ifdef CONFIG_ZONE_DMA
> +#define IFDEF_ZONE_DMA(X) X
> +#else
> +#define IFDEF_ZONE_DMA(X)
> +#endif
> +
> +#ifdef CONFIG_ZONE_DMA32
> +#define IFDEF_ZONE_DMA32(X) X
> +#else
> +#define IFDEF_ZONE_DMA32(X)
> +#endif
> +
> +#ifdef CONFIG_ZONE_HIGHMEM_
> +#define IFDEF_ZONE_HIGHMEM(X) X
> +#else
> +#define IFDEF_ZONE_HIGHMEM(X)
> +#endif
> +
> +#define ZONE_TYPE						\
> +	IFDEF_ZONE_DMA(		EM (ZONE_DMA,	 "DMA"))	\
> +	IFDEF_ZONE_DMA32(	EM (ZONE_DMA32,	 "DMA32"))	\
> +				EM (ZONE_NORMAL, "Normal")	\
> +	IFDEF_ZONE_HIGHMEM(	EM (ZONE_HIGHMEM,"HighMem"))	\
> +				EMe(ZONE_MOVABLE,"Movable")
> +

Hmm, have you tried to compile this with CONFIG_ZONE_HIGHMEM disabled,
and CONFIG_ZONE_DMA and/or CONFIG_ZONE_DMA32 enabled?

The EMe() macro must come last, as it doesn't have the ending comma and
the __print_symbolic() can fail to compile due to it.

-- Steve


>  /*
>   * First define the enums in the above macros to be exported to userspace
>   * via TRACE_DEFINE_ENUM().
> @@ -28,6 +53,7 @@

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] mm, compaction: export tracepoints zone names to userspace
  2015-08-31 14:58   ` Steven Rostedt
@ 2015-08-31 15:02     ` Vlastimil Babka
  2015-08-31 15:13       ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Vlastimil Babka @ 2015-08-31 15:02 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Andrew Morton, linux-kernel, linux-mm, Joonsoo Kim, Ingo Molnar,
	Mel Gorman, David Rientjes

On 08/31/2015 04:58 PM, Steven Rostedt wrote:
> On Thu, 27 Aug 2015 17:24:03 +0200
> Vlastimil Babka <vbabka@suse.cz> wrote:
>
>> Some compaction tracepoints use zone->name to print which zone is being
>> compacted. This works for in-kernel printing, but not userspace trace printing
>> of raw captured trace such as via trace-cmd report.
>>
>> This patch uses zone_idx() instead of zone->name as the raw value, and when
>> printing, converts the zone_type to string using the appropriate EM() macros
>> and some ugly tricks to overcome the problem that half the values depend on
>> CONFIG_ options and one does not simply use #ifdef inside of #define.
>>
>> trace-cmd output before:
>> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
>> zone=ffffffff81815d7a order=9 ret=partial
>>
>> after:
>> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
>> zone=Normal   order=9 ret=partial
>>
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Mel Gorman <mgorman@suse.de>
>> Cc: David Rientjes <rientjes@google.com>
>> ---
>>   include/trace/events/compaction.h | 38 ++++++++++++++++++++++++++++++++------
>>   1 file changed, 32 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
>> index 1275a55..8daa8fa 100644
>> --- a/include/trace/events/compaction.h
>> +++ b/include/trace/events/compaction.h
>> @@ -18,6 +18,31 @@
>>   	EM( COMPACT_NO_SUITABLE_PAGE,	"no_suitable_page")	\
>>   	EMe(COMPACT_NOT_SUITABLE_ZONE,	"not_suitable_zone")
>>
>> +#ifdef CONFIG_ZONE_DMA
>> +#define IFDEF_ZONE_DMA(X) X
>> +#else
>> +#define IFDEF_ZONE_DMA(X)
>> +#endif
>> +
>> +#ifdef CONFIG_ZONE_DMA32
>> +#define IFDEF_ZONE_DMA32(X) X
>> +#else
>> +#define IFDEF_ZONE_DMA32(X)
>> +#endif
>> +
>> +#ifdef CONFIG_ZONE_HIGHMEM_
>> +#define IFDEF_ZONE_HIGHMEM(X) X
>> +#else
>> +#define IFDEF_ZONE_HIGHMEM(X)
>> +#endif
>> +
>> +#define ZONE_TYPE						\
>> +	IFDEF_ZONE_DMA(		EM (ZONE_DMA,	 "DMA"))	\
>> +	IFDEF_ZONE_DMA32(	EM (ZONE_DMA32,	 "DMA32"))	\
>> +				EM (ZONE_NORMAL, "Normal")	\
>> +	IFDEF_ZONE_HIGHMEM(	EM (ZONE_HIGHMEM,"HighMem"))	\
>> +				EMe(ZONE_MOVABLE,"Movable")
>> +
>
> Hmm, have you tried to compile this with CONFIG_ZONE_HIGHMEM disabled,
> and CONFIG_ZONE_DMA and/or CONFIG_ZONE_DMA32 enabled?

Yep, that's standard x86_64 situation (highmem disabled, dma+dma32 enabled).

> The EMe() macro must come last, as it doesn't have the ending comma and
> the __print_symbolic() can fail to compile due to it.

Thanks to ZONE_MOVABLE being unconditional, EMe(ZONE_MOVABLE...) is 
always last. Otherwise the macros would get even more ugly...

> -- Steve
>
>
>>   /*
>>    * First define the enums in the above macros to be exported to userspace
>>    * via TRACE_DEFINE_ENUM().
>> @@ -28,6 +53,7 @@

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] mm, compaction: export tracepoints zone names to userspace
  2015-08-31 15:02     ` Vlastimil Babka
@ 2015-08-31 15:13       ` Steven Rostedt
  0 siblings, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2015-08-31 15:13 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-kernel, linux-mm, Joonsoo Kim, Ingo Molnar,
	Mel Gorman, David Rientjes

On Mon, 31 Aug 2015 17:02:38 +0200
Vlastimil Babka <vbabka@suse.cz> wrote:


> >> +#define ZONE_TYPE						\
> >> +	IFDEF_ZONE_DMA(		EM (ZONE_DMA,	 "DMA"))	\
> >> +	IFDEF_ZONE_DMA32(	EM (ZONE_DMA32,	 "DMA32"))	\
> >> +				EM (ZONE_NORMAL, "Normal")	\
> >> +	IFDEF_ZONE_HIGHMEM(	EM (ZONE_HIGHMEM,"HighMem"))	\
> >> +				EMe(ZONE_MOVABLE,"Movable")
> >> +
> >
> > Hmm, have you tried to compile this with CONFIG_ZONE_HIGHMEM disabled,
> > and CONFIG_ZONE_DMA and/or CONFIG_ZONE_DMA32 enabled?
> 
> Yep, that's standard x86_64 situation (highmem disabled, dma+dma32 enabled).
> 
> > The EMe() macro must come last, as it doesn't have the ending comma and
> > the __print_symbolic() can fail to compile due to it.
> 
> Thanks to ZONE_MOVABLE being unconditional, EMe(ZONE_MOVABLE...) is 
> always last. Otherwise the macros would get even more ugly...

Ah! My mistake was to see where the end parenthesis of
IFDEF_ZONE_HIGHMEM() laid. It looked to me that it encompassed
ZONE_MOVABLE. But obviously it does not.

-- Steve

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace
  2015-08-31 14:55 ` [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Steven Rostedt
@ 2015-08-31 15:27   ` Vlastimil Babka
  0 siblings, 0 replies; 11+ messages in thread
From: Vlastimil Babka @ 2015-08-31 15:27 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Andrew Morton, linux-kernel, linux-mm, Joonsoo Kim, Ingo Molnar,
	Mel Gorman, David Rientjes

On 08/31/2015 04:55 PM, Steven Rostedt wrote:
> On Thu, 27 Aug 2015 17:24:02 +0200
> Vlastimil Babka <vbabka@suse.cz> wrote:
>
>> Some compaction tracepoints convert the integer return values to strings using
>> the compaction_status_string array. This works for in-kernel printing, but not
>> userspace trace printing of raw captured trace such as via trace-cmd report.
>>
>> This patch converts the private array to appropriate tracepoint macros that
>> result in proper userspace support.
>>
>> trace-cmd output before:
>> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
>>    zone=ffffffff81815d7a order=9 ret=
>>
>> after:
>> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
>>    zone=ffffffff81815d7a order=9 ret=partial
>>
>
> Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

Thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] mm, compaction: export tracepoints zone names to userspace
  2015-08-27 15:24 ` [PATCH 2/3] mm, compaction: export tracepoints zone names " Vlastimil Babka
  2015-08-31 14:58   ` Steven Rostedt
@ 2015-08-31 15:32   ` Steven Rostedt
  1 sibling, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2015-08-31 15:32 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-kernel, linux-mm, Joonsoo Kim, Ingo Molnar,
	Mel Gorman, David Rientjes

On Thu, 27 Aug 2015 17:24:03 +0200
Vlastimil Babka <vbabka@suse.cz> wrote:

> Some compaction tracepoints use zone->name to print which zone is being
> compacted. This works for in-kernel printing, but not userspace trace printing
> of raw captured trace such as via trace-cmd report.
> 
> This patch uses zone_idx() instead of zone->name as the raw value, and when
> printing, converts the zone_type to string using the appropriate EM() macros
> and some ugly tricks to overcome the problem that half the values depend on
> CONFIG_ options and one does not simply use #ifdef inside of #define.
> 
> trace-cmd output before:
> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
> zone=ffffffff81815d7a order=9 ret=partial
> 
> after:
> transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
> zone=Normal   order=9 ret=partial
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: David Rientjes <rientjes@google.com>
> ---
>  include/trace/events/compaction.h | 38 ++++++++++++++++++++++++++++++++------
>  1 file changed, 32 insertions(+), 6 deletions(-)
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint
  2015-08-27 15:24 ` [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint Vlastimil Babka
@ 2015-09-07  5:53   ` Joonsoo Kim
  2015-09-08 16:29     ` Vlastimil Babka
  0 siblings, 1 reply; 11+ messages in thread
From: Joonsoo Kim @ 2015-09-07  5:53 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-kernel, linux-mm, Mel Gorman, David Rientjes

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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint
  2015-09-07  5:53   ` Joonsoo Kim
@ 2015-09-08 16:29     ` Vlastimil Babka
  0 siblings, 0 replies; 11+ messages in thread
From: Vlastimil Babka @ 2015-09-08 16:29 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, linux-kernel, linux-mm, Mel Gorman, David Rientjes

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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-09-08 16:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-27 15:24 [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Vlastimil Babka
2015-08-27 15:24 ` [PATCH 2/3] mm, compaction: export tracepoints zone names " Vlastimil Babka
2015-08-31 14:58   ` Steven Rostedt
2015-08-31 15:02     ` Vlastimil Babka
2015-08-31 15:13       ` Steven Rostedt
2015-08-31 15:32   ` Steven Rostedt
2015-08-27 15:24 ` [PATCH 3/3] mm, compaction: disginguish contended status in tracepoint Vlastimil Babka
2015-09-07  5:53   ` Joonsoo Kim
2015-09-08 16:29     ` Vlastimil Babka
2015-08-31 14:55 ` [PATCH 1/3] mm, compaction: export tracepoints status strings to userspace Steven Rostedt
2015-08-31 15:27   ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).