diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-11-23 00:22:56 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-23 03:17:26 -0500 |
commit | f201ae2356c74bcae130b2177b3dca903ea98071 (patch) | |
tree | c4b1b43fbe0a4594cb86749b2e7098fe15eb86ba /kernel/exit.c | |
parent | a0a70c735ef714fe1b6777b571630c3d50c7b008 (diff) |
tracing/function-return-tracer: store return stack into task_struct and allocate it dynamically
Impact: use deeper function 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 overruns anymore.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 35c8ec2ba03a..b9d446329da1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/task_io_accounting_ops.h> | 47 | #include <linux/task_io_accounting_ops.h> |
48 | #include <linux/tracehook.h> | 48 | #include <linux/tracehook.h> |
49 | #include <trace/sched.h> | 49 | #include <trace/sched.h> |
50 | #include <linux/ftrace.h> | ||
50 | 51 | ||
51 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
52 | #include <asm/unistd.h> | 53 | #include <asm/unistd.h> |
@@ -1127,7 +1128,9 @@ NORET_TYPE void do_exit(long code) | |||
1127 | preempt_disable(); | 1128 | preempt_disable(); |
1128 | /* causes final put_task_struct in finish_task_switch(). */ | 1129 | /* causes final put_task_struct in finish_task_switch(). */ |
1129 | tsk->state = TASK_DEAD; | 1130 | tsk->state = TASK_DEAD; |
1130 | 1131 | #ifdef CONFIG_FUNCTION_RET_TRACER | |
1132 | ftrace_retfunc_exit_task(tsk); | ||
1133 | #endif | ||
1131 | schedule(); | 1134 | schedule(); |
1132 | BUG(); | 1135 | BUG(); |
1133 | /* Avoid "noreturn function does return". */ | 1136 | /* Avoid "noreturn function does return". */ |