Messages in this thread Patch in this message | | | From | Frederic Weisbecker <> | Subject | [PATCH 11/19] tracing/workqueue: turn workfunc_stats::inserted into unsigned int | Date | Thu, 30 Apr 2009 02:27:12 +0200 |
| |
From: Zhaolei <zhaolei@cn.fujitsu.com>
struct workfunc_stats belongs to per_cpu struct of cpu_workqueue_stats, which means we only need to serialize its access from one cpu.
And because trace_workqueue_insertion() is already inside a section protected by the cpu workqueue lock, we can safely convert it into an unsigned int.
[ Impact: locking cleanup]
Reported-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> --- kernel/trace/trace_workqueue.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c index 69ae4aa..7a07d17 100644 --- a/kernel/trace/trace_workqueue.c +++ b/kernel/trace/trace_workqueue.c @@ -20,12 +20,9 @@ struct workfunc_stats { /* Addr of worklet's callback function */ work_func_t func; - /* Can be inserted on different workqueues, need to be atomic */ - atomic_t inserted; - /* - * Don't need to be atomic, works are serialized in a single workqueue - * thread on a single CPU. - */ + + /* Protected by cpu workqueue lock */ + unsigned int inserted; unsigned int executed; }; @@ -80,7 +77,7 @@ int do_worklet_enqueue(struct cpu_workqueue_stats *cws, list_add_tail(&wfstat->list, &cws->workfunclist); found: - atomic_inc(&wfstat->inserted); + wfstat->inserted++; return 0; } @@ -331,7 +328,7 @@ static int workqueue_stat_show(struct seq_file *s, void *p) int lastwf = list_is_last(&wfstat->list, &cws->workfunclist); seq_printf(s, "%3d %6d %6u %c-%pF\n", cws->cpu, - atomic_read(&wfstat->inserted), + wfstat->inserted, wfstat->executed, lastwf ? '`' : '|', wfstat->func); -- 1.6.2.3
| |