rcu: Remove redundant preempt_disable() from rcu_note_voluntary_context_switch()
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 5 Aug 2014 12:23:35 +0000 (05:23 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Sun, 7 Sep 2014 23:27:32 +0000 (16:27 -0700)
commit8b5555224f194d5a93075e072f604e4399a2c912
tree73428522f81fab6c4f5797d68a3930eeede67b52
parent36b8d3d3068622a754971ef0b4d7cfd7e9e442b9
rcu: Remove redundant preempt_disable() from rcu_note_voluntary_context_switch()

In theory, synchronize_sched() requires a read-side critical section
to order against.  In practice, preemption can be thought of as
being disabled across every machine instruction, at least for those
machine instructions that are not in the idle loop and not on offline
CPUs.  So this commit removes the redundant preempt_disable() from
rcu_note_voluntary_context_switch().

Please note that the single instruction in question is the store of
zero to ->rcu_tasks_holdout.  The "if" is simply a performance optimization
that avoids unnecessary stores.  To see this, keep in mind that both
the "if" condition and the store are in a quiescent state.  Therefore,
even if the task is preempted for a full grace period (presumably due
to its having done a context switch beforehand), the store will be
recording a legitimate quiescent state.

Reported-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Conflicts:
include/linux/rcupdate.h
include/linux/rcupdate.h