Skip to content

Commit

Permalink
tracing/ftrace: provide the macro task_curr_ret_stack()
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Dec 5, 2008
1 parent 77d683f commit 21a8c46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 11 additions & 0 deletions include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/types.h>
#include <linux/kallsyms.h>
#include <linux/bitops.h>
#include <linux/sched.h>

#ifdef CONFIG_FUNCTION_TRACER

Expand Down Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 21a8c46

Please sign in to comment.