]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
srcu: Simplify __srcu_read_unlock() via this_cpu_dec()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 29 Nov 2012 08:46:02 +0000 (16:46 +0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 7 Feb 2013 23:06:25 +0000 (15:06 -0800)
This commit replaces disabling of preemption and decrement of a per-CPU
variable with this_cpu_dec(), which avoids preemption disabling on x86
and shortens the code on all platforms.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/srcu.c

index 2b859828cdc327d811627fbf877318de8dbc5595..c9d003bc6c49269c098c66771f237a116d1b2c7b 100644 (file)
@@ -321,10 +321,8 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock);
  */
 void __srcu_read_unlock(struct srcu_struct *sp, int idx)
 {
-       preempt_disable();
        smp_mb(); /* C */  /* Avoid leaking the critical section. */
-       ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->c[idx]) -= 1;
-       preempt_enable();
+       this_cpu_dec(sp->per_cpu_ref->c[idx]);
 }
 EXPORT_SYMBOL_GPL(__srcu_read_unlock);