diff options
author | Christoph Lameter <cl@linux.com> | 2010-12-08 17:42:23 +0100 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-12-17 15:18:05 +0100 |
commit | 3ea9f6833c8f865a221b59ce37d7650dcf3b3e17 (patch) | |
tree | 1f304f3ef65c84c9a6446d2ad7fa3ce2e7e248ad | |
parent | b2e4ae69757cdfef4c612a04f097c1e20489a565 (diff) | |
download | linux-3.10-3ea9f6833c8f865a221b59ce37d7650dcf3b3e17.tar.gz linux-3.10-3ea9f6833c8f865a221b59ce37d7650dcf3b3e17.tar.bz2 linux-3.10-3ea9f6833c8f865a221b59ce37d7650dcf3b3e17.zip |
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 <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>
-rw-r--r-- | drivers/connector/cn_proc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index a7f046b0096..2b46a7efa0a 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) |