linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace/page_ref: print out the page migratetype name
@ 2019-03-27  5:09 Huang Shijie
  2019-03-27 13:24 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Shijie @ 2019-03-27  5:09 UTC (permalink / raw)
  To: rostedt; +Cc: mingo, linux-kernel, Huang Shijie

Print out the page migratetype name which is more readable.

Signed-off-by: Huang Shijie <sjhuang@iluvatar.ai>
---
 include/trace/events/page_ref.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h
index 5d2ea93956ce..94df979c2d6b 100644
--- a/include/trace/events/page_ref.h
+++ b/include/trace/events/page_ref.h
@@ -36,11 +36,12 @@ DECLARE_EVENT_CLASS(page_ref_mod_template,
 		__entry->val = v;
 	),
 
-	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
+	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%s val=%d",
 		__entry->pfn,
 		show_page_flags(__entry->flags & ((1UL << NR_PAGEFLAGS) - 1)),
 		__entry->count,
-		__entry->mapcount, __entry->mapping, __entry->mt,
+		__entry->mapcount, __entry->mapping,
+		migratetype_names[__entry->mt],
 		__entry->val)
 );
 
@@ -86,11 +87,12 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
 		__entry->ret = ret;
 	),
 
-	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
+	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%s val=%d ret=%d",
 		__entry->pfn,
 		show_page_flags(__entry->flags & ((1UL << NR_PAGEFLAGS) - 1)),
 		__entry->count,
-		__entry->mapcount, __entry->mapping, __entry->mt,
+		__entry->mapcount, __entry->mapping,
+		migratetype_names[__entry->mt],
 		__entry->val, __entry->ret)
 );
 
-- 
2.17.1


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

* Re: [PATCH] trace/page_ref: print out the page migratetype name
  2019-03-27  5:09 [PATCH] trace/page_ref: print out the page migratetype name Huang Shijie
@ 2019-03-27 13:24 ` Steven Rostedt
  2019-03-28  0:56   ` Huang Shijie
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2019-03-27 13:24 UTC (permalink / raw)
  To: Huang Shijie; +Cc: mingo, linux-kernel

On Wed, 27 Mar 2019 13:09:37 +0800
Huang Shijie <sjhuang@iluvatar.ai> wrote:

> Print out the page migratetype name which is more readable.

Except that it breaks perf and trace-cmd, as they wont know what a
migratetype_names array contains.

See how writeback does it. Which would be something like this for you.

/* enums need to be exported to user space */
#undef EM
#undef EMe
#undef EM_CMA
#undef EM_ISOLATE
#define EM(a)	 	TRACE_DEFINE_ENUM(MIGRATE_##a);
#define EMe(a)		TRACE_DEFINE_ENUM(MIGRATE_##a);

#ifdef CONFIG_CMA
# define EM_CMA		TRACE_DEFINE_ENUM(MIGRATE_CMA);
#else
# define EM_CMA
#endif

#ifdef CONFIG_MEMORY_ISOLATION
# define EM_ISOLATE	TRACE_DEFINE_ENUM(MIGRATE_ISOLATION);
#else
# define EM_ISOLATE
#endif

#define MIGRATE_ENUM_TYPES	\
	EM(UNMOVABLE)		\
	EM(MOVABLE)		\
	EM(RECLAIMABLE)		\
	EM(PCPTYPES)		\
	EM(HIGHATOMIC)		\
	EM_CMA			\
	EM_ISOLATE		\
	EMe(TYPES)

MIGRATE_ENUM_TYPES

#undef EM
#undef EMe
#undef EM_CMA
#undef EM_ISOLATE
#define EM(a)		{ MIGRATE_##a, #a },
#define EMe(a)		{ MIGRATE_##a, #a }

#ifdef CONFIG_CMA
# define EM_CMA		{ MIGRATE_CMA, "CMA" },
#else
# define EM_CMA
#endif

#ifdef CONFIG_MEMORY_ISOLATION
# define EM_ISOLATE	{ MIGRATE_ISOLATION, "ISOLATION" }
#else
# define EM_ISOLATE
#endif

> 
> Signed-off-by: Huang Shijie <sjhuang@iluvatar.ai>
> ---
>  include/trace/events/page_ref.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h
> index 5d2ea93956ce..94df979c2d6b 100644
> --- a/include/trace/events/page_ref.h
> +++ b/include/trace/events/page_ref.h
> @@ -36,11 +36,12 @@ DECLARE_EVENT_CLASS(page_ref_mod_template,
>  		__entry->val = v;
>  	),
>  
> -	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
> +	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%s val=%d",
>  		__entry->pfn,
>  		show_page_flags(__entry->flags & ((1UL << NR_PAGEFLAGS) - 1)),
>  		__entry->count,
> -		__entry->mapcount, __entry->mapping, __entry->mt,
> +		__entry->mapcount, __entry->mapping,
> +		migratetype_names[__entry->mt],

Then here you add:

		print_symbolic(__entry->mt, MIGRATE_ENUM_TYPES),

>  		__entry->val)
>  );
>  
> @@ -86,11 +87,12 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
>  		__entry->ret = ret;
>  	),
>  
> -	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
> +	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%s val=%d ret=%d",
>  		__entry->pfn,
>  		show_page_flags(__entry->flags & ((1UL << NR_PAGEFLAGS) - 1)),
>  		__entry->count,
> -		__entry->mapcount, __entry->mapping, __entry->mt,
> +		__entry->mapcount, __entry->mapping,
> +		migratetype_names[__entry->mt],
>  		__entry->val, __entry->ret)
>  );
>  


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

* Re: [PATCH] trace/page_ref: print out the page migratetype name
  2019-03-27 13:24 ` Steven Rostedt
@ 2019-03-28  0:56   ` Huang Shijie
  0 siblings, 0 replies; 3+ messages in thread
From: Huang Shijie @ 2019-03-28  0:56 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: mingo, linux-kernel

On Wed, Mar 27, 2019 at 09:24:22AM -0400, Steven Rostedt wrote:
> On Wed, 27 Mar 2019 13:09:37 +0800
> Huang Shijie <sjhuang@iluvatar.ai> wrote:
> 
> > Print out the page migratetype name which is more readable.
> 
> Except that it breaks perf and trace-cmd, as they wont know what a
> migratetype_names array contains.
> 
> See how writeback does it. Which would be something like this for you.
> 
> /* enums need to be exported to user space */
Thanks for pointing this...

I did not notice that it will breaks the perf and trace-cmd.

So please just ignore this patch.

Thanks
Huang Shijie

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

end of thread, other threads:[~2019-03-28  0:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27  5:09 [PATCH] trace/page_ref: print out the page migratetype name Huang Shijie
2019-03-27 13:24 ` Steven Rostedt
2019-03-28  0:56   ` Huang Shijie

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).