All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing, memcg, vmscan: Hide trace events when not in use
@ 2017-10-12 22:46 Steven Rostedt
  2017-10-13  6:38 ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2017-10-12 22:46 UTC (permalink / raw)
  To: LKML
  Cc: Vlastimil Babka, Mel Gorman, Balbir Singh, KOSAKI Motohiro,
	Andrew Morton

From: Steven Rostedt (VMware) <rostedt@goodmis.org>

When trace events are defined but not used they still create data
structures and functions for their use, even though nothing may be
using them.

The trace events mm_vmscan_memcg_reclaim_begin,
mm_vmscan_memcg_softlimit_reclaim_begin, mm_vmscan_memcg_reclaim_end,
and mm_vmscan_memcg_softlimit_reclaim_end are not used if CONFIG_MEMCG
is not defined. Do not create these trace events unless CONFIG_MEMCG is
defined.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Index: linux-trace.git/include/trace/events/vmscan.h
===================================================================
--- linux-trace.git.orig/include/trace/events/vmscan.h
+++ linux-trace.git/include/trace/events/vmscan.h
@@ -133,6 +133,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_be
 	TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
 );
 
+#ifdef CONFIG_MEMCG
 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
 
 	TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
@@ -146,6 +147,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_be
 
 	TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
 );
+#endif /* CONFIG_MEMCG */
 
 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
 
@@ -171,6 +173,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_en
 	TP_ARGS(nr_reclaimed)
 );
 
+#ifdef CONFIG_MEMCG
 DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
 
 	TP_PROTO(unsigned long nr_reclaimed),
@@ -184,6 +187,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_en
 
 	TP_ARGS(nr_reclaimed)
 );
+#endif /* CONFIG_MEMCG */
 
 TRACE_EVENT(mm_shrink_slab_start,
 	TP_PROTO(struct shrinker *shr, struct shrink_control *sc,

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

* Re: [PATCH] tracing, memcg, vmscan: Hide trace events when not in use
  2017-10-12 22:46 [PATCH] tracing, memcg, vmscan: Hide trace events when not in use Steven Rostedt
@ 2017-10-13  6:38 ` Michal Hocko
  2017-10-13 14:28   ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2017-10-13  6:38 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Vlastimil Babka, Mel Gorman, Balbir Singh, KOSAKI Motohiro,
	Andrew Morton

On Thu 12-10-17 18:46:32, Steven Rostedt wrote:
> From: Steven Rostedt (VMware) <rostedt@goodmis.org>
> 
> When trace events are defined but not used they still create data
> structures and functions for their use, even though nothing may be
> using them.
> 
> The trace events mm_vmscan_memcg_reclaim_begin,
> mm_vmscan_memcg_softlimit_reclaim_begin, mm_vmscan_memcg_reclaim_end,
> and mm_vmscan_memcg_softlimit_reclaim_end are not used if CONFIG_MEMCG
> is not defined. Do not create these trace events unless CONFIG_MEMCG is
> defined.

I do not understand the ftrace machinery and I have to admit I was under
impression that nothing really gets defined if the code using them
doesn't exist but if this is not the case then this patch makes sense to
me

> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> Index: linux-trace.git/include/trace/events/vmscan.h
> ===================================================================
> --- linux-trace.git.orig/include/trace/events/vmscan.h
> +++ linux-trace.git/include/trace/events/vmscan.h
> @@ -133,6 +133,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_be
>  	TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
>  );
>  
> +#ifdef CONFIG_MEMCG
>  DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
>  
>  	TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
> @@ -146,6 +147,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_be
>  
>  	TP_ARGS(order, may_writepage, gfp_flags, classzone_idx)
>  );
> +#endif /* CONFIG_MEMCG */
>  
>  DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
>  
> @@ -171,6 +173,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_en
>  	TP_ARGS(nr_reclaimed)
>  );
>  
> +#ifdef CONFIG_MEMCG
>  DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
>  
>  	TP_PROTO(unsigned long nr_reclaimed),
> @@ -184,6 +187,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_en
>  
>  	TP_ARGS(nr_reclaimed)
>  );
> +#endif /* CONFIG_MEMCG */
>  
>  TRACE_EVENT(mm_shrink_slab_start,
>  	TP_PROTO(struct shrinker *shr, struct shrink_control *sc,

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] tracing, memcg, vmscan: Hide trace events when not in use
  2017-10-13  6:38 ` Michal Hocko
@ 2017-10-13 14:28   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2017-10-13 14:28 UTC (permalink / raw)
  To: Michal Hocko
  Cc: LKML, Vlastimil Babka, Mel Gorman, Balbir Singh, KOSAKI Motohiro,
	Andrew Morton

On Fri, 13 Oct 2017 08:38:26 +0200
Michal Hocko <mhocko@kernel.org> wrote:

> I do not understand the ftrace machinery 

Not many do :-/

> and I have to admit I was under
> impression that nothing really gets defined if the code using them
> doesn't exist but if this is not the case then this patch makes sense to
> me

Sometimes events are created by kernel proper that are used by modules,
or created by modules to be used by other modules (kvm does this with
kvm_intel and kvm_amd). Unfortunately, for these cases they need to
stay. Or later, I plan on moving them to where they are used, because
they have the same issue (wasting memory).

> 
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>  
> 
> Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

-- Steve

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

end of thread, other threads:[~2017-10-13 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 22:46 [PATCH] tracing, memcg, vmscan: Hide trace events when not in use Steven Rostedt
2017-10-13  6:38 ` Michal Hocko
2017-10-13 14:28   ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.