linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fgraph: Remove redundant ftrace_graph_notrace_addr() test
@ 2019-07-30 14:08 Changbin Du
  2019-07-30 16:15 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Changbin Du @ 2019-07-30 14:08 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Ingo Molnar, linux-kernel, Changbin Du

We already have tested it before. The second one should be removed.
With this change, the performance should have little improvement.

Fixes: 9cd2992f2d6c ("fgraph: Have set_graph_notrace only affect function_graph tracer")
Signed-off-by: Changbin Du <changbin.du@gmail.com>
---
 kernel/trace/trace_functions_graph.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 69ebf3c2f1b5..78af97163147 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -137,6 +137,13 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
 	if (trace_recursion_test(TRACE_GRAPH_NOTRACE_BIT))
 		return 0;
 
+	/*
+	 * Do not trace a function if it's filtered by set_graph_notrace.
+	 * Make the index of ret stack negative to indicate that it should
+	 * ignore further functions.  But it needs its own ret stack entry
+	 * to recover the original index in order to continue tracing after
+	 * returning from the function.
+	 */
 	if (ftrace_graph_notrace_addr(trace->func)) {
 		trace_recursion_set(TRACE_GRAPH_NOTRACE_BIT);
 		/*
@@ -155,16 +162,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
 	if (ftrace_graph_ignore_irqs())
 		return 0;
 
-	/*
-	 * Do not trace a function if it's filtered by set_graph_notrace.
-	 * Make the index of ret stack negative to indicate that it should
-	 * ignore further functions.  But it needs its own ret stack entry
-	 * to recover the original index in order to continue tracing after
-	 * returning from the function.
-	 */
-	if (ftrace_graph_notrace_addr(trace->func))
-		return 1;
-
 	/*
 	 * Stop here if tracing_threshold is set. We only write function return
 	 * events to the ring buffer.
-- 
2.20.1


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

* Re: [PATCH] fgraph: Remove redundant ftrace_graph_notrace_addr() test
  2019-07-30 14:08 [PATCH] fgraph: Remove redundant ftrace_graph_notrace_addr() test Changbin Du
@ 2019-07-30 16:15 ` Steven Rostedt
  2019-07-31 10:31   ` Changbin Du
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2019-07-30 16:15 UTC (permalink / raw)
  To: Changbin Du; +Cc: Ingo Molnar, linux-kernel

On Tue, 30 Jul 2019 22:08:50 +0800
Changbin Du <changbin.du@gmail.com> wrote:

> We already have tested it before. The second one should be removed.
> With this change, the performance should have little improvement.
> 
> Fixes: 9cd2992f2d6c ("fgraph: Have set_graph_notrace only affect function_graph tracer")

Thanks! I think this should even be marked for stable. Not really a bad
bug, but a bug none the less.

-- Steve


> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
>  kernel/trace/trace_functions_graph.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 69ebf3c2f1b5..78af97163147 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -137,6 +137,13 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
>  	if (trace_recursion_test(TRACE_GRAPH_NOTRACE_BIT))
>  		return 0;
>  
> +	/*
> +	 * Do not trace a function if it's filtered by set_graph_notrace.
> +	 * Make the index of ret stack negative to indicate that it should
> +	 * ignore further functions.  But it needs its own ret stack entry
> +	 * to recover the original index in order to continue tracing after
> +	 * returning from the function.
> +	 */
>  	if (ftrace_graph_notrace_addr(trace->func)) {
>  		trace_recursion_set(TRACE_GRAPH_NOTRACE_BIT);
>  		/*
> @@ -155,16 +162,6 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
>  	if (ftrace_graph_ignore_irqs())
>  		return 0;
>  
> -	/*
> -	 * Do not trace a function if it's filtered by set_graph_notrace.
> -	 * Make the index of ret stack negative to indicate that it should
> -	 * ignore further functions.  But it needs its own ret stack entry
> -	 * to recover the original index in order to continue tracing after
> -	 * returning from the function.
> -	 */
> -	if (ftrace_graph_notrace_addr(trace->func))
> -		return 1;
> -
>  	/*
>  	 * Stop here if tracing_threshold is set. We only write function return
>  	 * events to the ring buffer.


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

* Re: [PATCH] fgraph: Remove redundant ftrace_graph_notrace_addr() test
  2019-07-30 16:15 ` Steven Rostedt
@ 2019-07-31 10:31   ` Changbin Du
  2019-07-31 11:58     ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Changbin Du @ 2019-07-31 10:31 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Changbin Du, Ingo Molnar, linux-kernel

On Tue, Jul 30, 2019 at 12:15:27PM -0400, Steven Rostedt wrote:
> On Tue, 30 Jul 2019 22:08:50 +0800
> Changbin Du <changbin.du@gmail.com> wrote:
> 
> > We already have tested it before. The second one should be removed.
> > With this change, the performance should have little improvement.
> > 
> > Fixes: 9cd2992f2d6c ("fgraph: Have set_graph_notrace only affect function_graph tracer")
> 
> Thanks! I think this should even be marked for stable. Not really a bad
> bug, but a bug none the less.
>
Steven, need I resend this patch and cc stable mailist?

> -- Steve
> 
> 
- 
Cheers,
Changbin Du

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

* Re: [PATCH] fgraph: Remove redundant ftrace_graph_notrace_addr() test
  2019-07-31 10:31   ` Changbin Du
@ 2019-07-31 11:58     ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2019-07-31 11:58 UTC (permalink / raw)
  To: Changbin Du; +Cc: Ingo Molnar, linux-kernel

On Wed, 31 Jul 2019 18:31:45 +0800
Changbin Du <changbin.du@gmail.com> wrote:

> On Tue, Jul 30, 2019 at 12:15:27PM -0400, Steven Rostedt wrote:
> > On Tue, 30 Jul 2019 22:08:50 +0800
> > Changbin Du <changbin.du@gmail.com> wrote:
> >   
> > > We already have tested it before. The second one should be removed.
> > > With this change, the performance should have little improvement.
> > > 
> > > Fixes: 9cd2992f2d6c ("fgraph: Have set_graph_notrace only affect function_graph tracer")  
> > 
> > Thanks! I think this should even be marked for stable. Not really a bad
> > bug, but a bug none the less.
> >  
> Steven, need I resend this patch and cc stable mailist?
> 

No.

I actually already pulled it in and ran it through my tests. I'm
waiting on some more tests before pushing it off to Linus.

-- Steve

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

end of thread, other threads:[~2019-07-31 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 14:08 [PATCH] fgraph: Remove redundant ftrace_graph_notrace_addr() test Changbin Du
2019-07-30 16:15 ` Steven Rostedt
2019-07-31 10:31   ` Changbin Du
2019-07-31 11:58     ` Steven Rostedt

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