Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a41344a authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Paul E. McKenney
Browse files

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: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent 0351096e
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);