From 3ea9f6833c8f865a221b59ce37d7650dcf3b3e17 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 8 Dec 2010 17:42:23 +0100 Subject: connector: Use this_cpu operations The patch was originally in the use cpuops patchset but it needs an inc_return and is therefore dependent on an extension of the cpu ops. Fixed up and verified that it compiles. get_seq can benefit from this_cpu_operations. Address calculation is avoided and the increment is done using an xadd. Cc: Scott James Remnant Cc: Mike Frysinger Acked-by: H. Peter Anvin Signed-off-by: Christoph Lameter Signed-off-by: Tejun Heo --- drivers/connector/cn_proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/connector/cn_proc.c') diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index a7f046b0096c..2b46a7efa0ac 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c @@ -43,9 +43,10 @@ static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 }; static inline void get_seq(__u32 *ts, int *cpu) { - *ts = get_cpu_var(proc_event_counts)++; + preempt_disable(); + *ts = __this_cpu_inc_return(proc_event_counts) -1; *cpu = smp_processor_id(); - put_cpu_var(proc_event_counts); + preempt_enable(); } void proc_fork_connector(struct task_struct *task) -- cgit v1.2.1