Skip to contentSkip to conversation

tracing/ftrace: provide the macro task_curr_ret_stack()

PATCH Applied Frederic Weisbecker 2 participants 2 messages Dec 4, 2008 – Dec 5, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 tracing/ftrace: provide the macro task_curr_ret_stack()

Impact: cleanup

As suggested by Steven Rostedt, this patch provide a new macro task_curr_ret_stack() to move the cpp conditionnal CONFIG into the linux/ftrace.h headers.

---
 include/linux/ftrace.h |   11 +++++++++++
 kernel/trace/trace.c   |    8 +-------
 2 files changed, 12 insertions(+), 7 deletions(-)
include/linux/ftrace.h +11 -0
index b295d31..b9b4d0a 100644
@@ -8,6 +8,7 @@
 #include <linux/types.h>
 #include <linux/kallsyms.h>
 #include <linux/bitops.h>
+#include <linux/sched.h>
 
 #ifdef CONFIG_FUNCTION_TRACER
 
@@ -387,9 +388,19 @@ extern void unregister_ftrace_graph(void);
 
 extern void ftrace_graph_init_task(struct task_struct *t);
 extern void ftrace_graph_exit_task(struct task_struct *t);
+
+static inline int task_curr_ret_stack(struct task_struct *t)
+{
+	return t->curr_ret_stack;
+}
 #else
 static inline void ftrace_graph_init_task(struct task_struct *t) { }
 static inline void ftrace_graph_exit_task(struct task_struct *t) { }
+
+static inline int task_curr_ret_stack(struct task_struct *tsk)
+{
+	return -1;
+}
 #endif
 
 #ifdef CONFIG_TRACING
kernel/trace/trace.c +1 -7
index 5dca6ef..7a93c66 100644
@@ -3657,13 +3657,7 @@ int __ftrace_printk(unsigned long ip, const char *fmt, ...)
 		return 0;
 
 	va_start(ap, fmt);
-
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-	ret = trace_vprintk(ip, current->curr_ret_stack, fmt, ap);
-#else
-	ret = trace_vprintk(ip, -1, fmt, ap);
-#endif
-
+	ret = trace_vprintk(ip, task_curr_ret_stack(current), fmt, ap);
 	va_end(ap);
 	return ret;
 }
Signature · 1 line
1.5.6.3
Applied
#1 lore raw
Quoted 11 lines · Frederic Weisbecker

Impact: cleanup

As suggested by Steven Rostedt, this patch provide a new macro task_curr_ret_stack() to move the cpp conditionnal CONFIG into the linux/ftrace.h headers.

---
 include/linux/ftrace.h |   11 +++++++++++
 kernel/trace/trace.c   |    8 +-------
 2 files changed, 12 insertions(+), 7 deletions(-)

applied to tip/tracing/ftrace, thanks!

Ingo