[PATCH 1/4] tracing/workqueue: turn workfunc_stats::inserted intounsigned int

From: Zhaolei
Date: Tue Apr 28 2009 - 06:53:43 EST


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@xxxxxxxxxx>
Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/