Skip to contentSkip to conversation

fgraph: Remove redundant ftrace_graph_notrace_addr() test

PATCH In review Changbin Du 2 participants 4 messages Jul 30, 2019 – Jul 31, 2019 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fgraph: Remove redundant ftrace_graph_notrace_addr() test

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")
---
 kernel/trace/trace_functions_graph.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
kernel/trace/trace_functions_graph.c +7 -10
index 69ebf3c2f1b5..78af97163147 100644
@@ -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.
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 4 lines · On Tue, 30 Jul 2019 22:08:50 +0800 Changbin Du <[email protected]> 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

Quoted 40 lines
---
 kernel/trace/trace_functions_graph.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
kernel/trace/trace_functions_graph.c +7 -10
index 69ebf3c2f1b5..78af97163147 100644
@@ -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 lore raw
Quoted 11 lines · Steven Rostedt
Quoted 4 lines · On Tue, 30 Jul 2019 22:08:50 +0800 Changbin Du <[email protected]> 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?

Quoted 3 lines

-- Steve

-
Cheers,
Changbin Du

maintainer
#3 lore raw
Quoted 7 lines · On Wed, 31 Jul 2019 18:31:45 +0800 Changbin Du <[email protected]> wrote:
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Tue, 30 Jul 2019 22:08:50 +0800 Changbin Du <[email protected]> wrote:

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

Quoted 7 lines
Quoted 5 lines
Quoted 1 line
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