提交 889a6c36 编写于 作者: K KOSAKI Motohiro 提交者: Steven Rostedt

tracing: Don't use tracing_record_cmdline() in workqueue tracer fix

commit c3ffc7a4
"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: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
上级 39842323
...@@ -193,12 +193,20 @@ static int workqueue_stat_show(struct seq_file *s, void *p) ...@@ -193,12 +193,20 @@ static int workqueue_stat_show(struct seq_file *s, void *p)
struct cpu_workqueue_stats *cws = p; struct cpu_workqueue_stats *cws = p;
unsigned long flags; unsigned long flags;
int cpu = cws->cpu; int cpu = cws->cpu;
struct task_struct *tsk = find_task_by_vpid(cws->pid); struct pid *pid;
struct task_struct *tsk;
seq_printf(s, "%3d %6d %6u %s\n", cws->cpu,
atomic_read(&cws->inserted), pid = find_get_pid(cws->pid);
cws->executed, if (pid) {
tsk ? tsk->comm : "<...>"); tsk = get_pid_task(pid, PIDTYPE_PID);
if (tsk) {
seq_printf(s, "%3d %6d %6u %s\n", cws->cpu,
atomic_read(&cws->inserted), cws->executed,
tsk->comm);
put_task_struct(tsk);
}
put_pid(pid);
}
spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags); spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags);
if (&cws->list == workqueue_cpu_stat(cpu)->list.next) if (&cws->list == workqueue_cpu_stat(cpu)->list.next)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册