diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-07-18 12:16:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 04:30:52 -0400 |
commit | 0a16b6075843325dc402edf80c1662838b929aff (patch) | |
tree | 124e49d8c0196f3c6eb7aa09a7c4c3c3157fff7a /kernel/exit.c | |
parent | 4a0897526bbc5c6ac0df80b16b8c60339e717ae2 (diff) |
tracing, sched: LTTng instrumentation - scheduler
Instrument the scheduler activity (sched_switch, migration, wakeups,
wait for a task, signal delivery) and process/thread
creation/destruction (fork, exit, kthread stop). Actually, kthread
creation is not instrumented in this patch because it is architecture
dependent. It allows to connect tracers such as ftrace which detects
scheduling latencies, good/bad scheduler decisions. Tools like LTTng can
export this scheduler information along with instrumentation of the rest
of the kernel activity to perform post-mortem analysis on the scheduler
activity.
About the performance impact of tracepoints (which is comparable to
markers), even without immediate values optimizations, tests done by
Hideo Aoki on ia64 show no regression. His test case was using hackbench
on a kernel where scheduler instrumentation (about 5 events in code
scheduler code) was added. See the "Tracepoints" patch header for
performance result detail.
Changelog :
- Change instrumentation location and parameter to match ftrace
instrumentation, previously done with kernel markers.
[ mingo@elte.hu: conflict resolutions ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Acked-by: 'Peter Zijlstra' <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 85a83c831856..7b71f87f1207 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/blkdev.h> | 47 | #include <linux/blkdev.h> |
48 | #include <linux/task_io_accounting_ops.h> | 48 | #include <linux/task_io_accounting_ops.h> |
49 | #include <linux/tracehook.h> | 49 | #include <linux/tracehook.h> |
50 | #include <trace/sched.h> | ||
50 | 51 | ||
51 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
52 | #include <asm/unistd.h> | 53 | #include <asm/unistd.h> |
@@ -149,7 +150,10 @@ static void __exit_signal(struct task_struct *tsk) | |||
149 | 150 | ||
150 | static void delayed_put_task_struct(struct rcu_head *rhp) | 151 | static void delayed_put_task_struct(struct rcu_head *rhp) |
151 | { | 152 | { |
152 | put_task_struct(container_of(rhp, struct task_struct, rcu)); | 153 | struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); |
154 | |||
155 | trace_sched_process_free(tsk); | ||
156 | put_task_struct(tsk); | ||
153 | } | 157 | } |
154 | 158 | ||
155 | 159 | ||
@@ -1074,6 +1078,8 @@ NORET_TYPE void do_exit(long code) | |||
1074 | 1078 | ||
1075 | if (group_dead) | 1079 | if (group_dead) |
1076 | acct_process(); | 1080 | acct_process(); |
1081 | trace_sched_process_exit(tsk); | ||
1082 | |||
1077 | exit_sem(tsk); | 1083 | exit_sem(tsk); |
1078 | exit_files(tsk); | 1084 | exit_files(tsk); |
1079 | exit_fs(tsk); | 1085 | exit_fs(tsk); |
@@ -1675,6 +1681,8 @@ static long do_wait(enum pid_type type, struct pid *pid, int options, | |||
1675 | struct task_struct *tsk; | 1681 | struct task_struct *tsk; |
1676 | int retval; | 1682 | int retval; |
1677 | 1683 | ||
1684 | trace_sched_process_wait(pid); | ||
1685 | |||
1678 | add_wait_queue(¤t->signal->wait_chldexit,&wait); | 1686 | add_wait_queue(¤t->signal->wait_chldexit,&wait); |
1679 | repeat: | 1687 | repeat: |
1680 | /* | 1688 | /* |