[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49F6E004.3000309@cn.fujitsu.com>
Date: Tue, 28 Apr 2009 18:52:52 +0800
From: Zhaolei <zhaolei@...fujitsu.com>
To: Zhaolei <zhaolei@...fujitsu.com>
CC: Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...e.hu>, Tom Zanussi <tzanussi@...il.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Oleg Nesterov <oleg@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/4] tracing/workqueue: turn workfunc_stats::inserted into
unsigned int
struct workfunc_stats is belong to per_cpu struct of cpu_workqueue_stats,
which means we only need to serialize its accessing 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: cleanup ]
Reported-by: Oleg Nesterov <oleg@...hat.com>
Signed-off-by: Zhao Lei <zhaolei@...fujitsu.com>
---
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.5.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists