]> Pileus Git - ~andy/linux/commitdiff
connector: Use this_cpu operations
authorChristoph Lameter <cl@linux.com>
Wed, 8 Dec 2010 16:42:23 +0000 (17:42 +0100)
committerTejun Heo <tj@kernel.org>
Fri, 17 Dec 2010 14:18:05 +0000 (15:18 +0100)
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 <scott@ubuntu.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/connector/cn_proc.c

index a7f046b0096ca26121a1016922fef359ee4d805c..2b46a7efa0ac78c5c4213609d7846422842ef17f 100644 (file)
@@ -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)