Skip to content

Commit

Permalink
connector: Use this_cpu operations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Lameter authored and Tejun Heo committed Dec 17, 2010
1 parent b2e4ae6 commit 3ea9f68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/connector/cn_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3ea9f68

Please sign in to comment.