aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_workqueue.c
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2009-03-12 20:03:04 -0400
committerSteven Rostedt <srostedt@redhat.com>2009-03-12 21:23:47 -0400
commit889a6c367283709a80dad9413488472596a1a1d2 (patch)
treefabe1614e30f9d6e306376159a05e91721b6cb60 /kernel/trace/trace_workqueue.c
parent39842323ceb368d2ea36ab7696aedbe296e13b61 (diff)
tracing: Don't use tracing_record_cmdline() in workqueue tracer fix
commit c3ffc7a40b7e94b094efe1c8ab4e24370a782b65 "Don't use tracing_record_cmdline() in workqueue tracer" has a race window. find_task_by_vpid() requires task_list_lock(). LKML-Reference: <20090313090042.43CD.A69D9226@jp.fujitsu.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace_workqueue.c')
-rw-r--r--kernel/trace/trace_workqueue.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index fb5ccac8bbc0..9ab035b58cf1 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -193,12 +193,20 @@ static int workqueue_stat_show(struct seq_file *s, void *p)
193 struct cpu_workqueue_stats *cws = p; 193 struct cpu_workqueue_stats *cws = p;
194 unsigned long flags; 194 unsigned long flags;
195 int cpu = cws->cpu; 195 int cpu = cws->cpu;
196 struct task_struct *tsk = find_task_by_vpid(cws->pid); 196 struct pid *pid;
197 197 struct task_struct *tsk;
198 seq_printf(s, "%3d %6d %6u %s\n", cws->cpu, 198
199 atomic_read(&cws->inserted), 199 pid = find_get_pid(cws->pid);
200 cws->executed, 200 if (pid) {
201 tsk ? tsk->comm : "<...>"); 201 tsk = get_pid_task(pid, PIDTYPE_PID);
202 if (tsk) {
203 seq_printf(s, "%3d %6d %6u %s\n", cws->cpu,
204 atomic_read(&cws->inserted), cws->executed,
205 tsk->comm);
206 put_task_struct(tsk);
207 }
208 put_pid(pid);
209 }
202 210
203 spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags); 211 spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags);
204 if (&cws->list == workqueue_cpu_stat(cpu)->list.next) 212 if (&cws->list == workqueue_cpu_stat(cpu)->list.next)