diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2012-11-29 03:46:02 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-02-07 18:06:25 -0500 |
commit | 5a41344a3d83ef2c08e40bfce1efa5795def9b82 (patch) | |
tree | 123d0fa065a35bb7de384edb5e753ec28beee7b0 /kernel/srcu.c | |
parent | 0351096eb0584ba927a00a37e18be7af135250c3 (diff) |
srcu: Simplify __srcu_read_unlock() via this_cpu_dec()
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>
Diffstat (limited to 'kernel/srcu.c')
-rw-r--r-- | kernel/srcu.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/srcu.c b/kernel/srcu.c index 2b859828cdc3..c9d003bc6c49 100644 --- a/kernel/srcu.c +++ b/kernel/srcu.c | |||
@@ -321,10 +321,8 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); | |||
321 | */ | 321 | */ |
322 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) | 322 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) |
323 | { | 323 | { |
324 | preempt_disable(); | ||
325 | smp_mb(); /* C */ /* Avoid leaking the critical section. */ | 324 | smp_mb(); /* C */ /* Avoid leaking the critical section. */ |
326 | ACCESS_ONCE(this_cpu_ptr(sp->per_cpu_ref)->c[idx]) -= 1; | 325 | this_cpu_dec(sp->per_cpu_ref->c[idx]); |
327 | preempt_enable(); | ||
328 | } | 326 | } |
329 | EXPORT_SYMBOL_GPL(__srcu_read_unlock); | 327 | EXPORT_SYMBOL_GPL(__srcu_read_unlock); |
330 | 328 | ||