[PATCH] tracing/function-return-tracer: clean up task start/exitcallbacks

From: Ingo Molnar
Date: Sun Nov 23 2008 - 03:21:59 EST



* Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:

> Impact: use deeper tracing depth safely
>
> Some tests showed that function return tracing needed a more deeper depth
> of function calls. But it could be unsafe to store these return addresses
> to the stack.
> So these arrays will now be allocated dynamically into task_struct of current
> only when the tracer is activated.
>
> Typical scheme when tracer is activated:
> _ allocate a return stack for each task in global list.
> _ fork: allocate the return stack for the newly created task
> _ exit: free return stack of current
> _ idle init: same as fork
>
> I chose a default depth of 50. I don't have anymore overruns (didn't tested for
> a long time).
>
> Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> ---
> arch/x86/include/asm/ftrace.h | 1 -
> arch/x86/include/asm/thread_info.h | 29 -----------
> arch/x86/kernel/ftrace.c | 29 ++++++-----
> include/linux/ftrace.h | 5 ++
> include/linux/sched.h | 23 ++++-----
> kernel/exit.c | 5 ++-
> kernel/fork.c | 4 ++
> kernel/sched.c | 3 +
> kernel/trace/ftrace.c | 96 +++++++++++++++++++++++++++++++++++-
> 9 files changed, 137 insertions(+), 58 deletions(-)

nice! Applied to tip/tracing/function-return-tracer and i started
testing it as well.

I've done the small cleanup below on top of your patch - we try to
avoid #ifdefs in core kernel code as much as possible, by hiding
.config details into include files.

Ingo

-------------->