linux-stable/kernel/rcu
Boqun Feng bb73c52bad rcu: Don't disable preemption for Tiny and Tree RCU readers
Because preempt_disable() maps to barrier() for non-debug builds,
it forces the compiler to spill and reload registers.  Because Tree
RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
barrier() instances generate needless extra code for each instance of
rcu_read_lock() and rcu_read_unlock().  This extra code slows down Tree
RCU and bloats Tiny RCU.

This commit therefore removes the preempt_disable() and preempt_enable()
from the non-preemptible implementations of __rcu_read_lock() and
__rcu_read_unlock(), respectively.  However, for debug purposes,
preempt_disable() and preempt_enable() are still invoked if
CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
atomic sections in non-preemptible kernels.

However, Tiny and Tree RCU operates by coalescing all RCU read-side
critical sections on a given CPU that lie between successive quiescent
states.  It is therefore necessary to compensate for removing barriers
from __rcu_read_lock() and __rcu_read_unlock() by adding them to a
couple of the RCU functions invoked during quiescent states, namely to
rcu_all_qs() and rcu_note_context_switch().  However, note that the latter
is more paranoia than necessity, at least until link-time optimizations
become more aggressive.

This is based on an earlier patch by Paul E. McKenney, fixing
a bug encountered in kernels built with CONFIG_PREEMPT=n and
CONFIG_PREEMPT_COUNT=y.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2015-10-06 11:08:23 -07:00
..
Makefile rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
rcu.h tiny_rcu: Directly force QS when call_rcu_[bh|sched]() on idle_task 2015-01-06 11:01:12 -08:00
rcutorture.c rcu: Use call_rcu_func_t to replace explicit type equivalents 2015-10-06 11:08:19 -07:00
srcu.c rcu: Use rcu_callback_t in call_rcu*() and friends 2015-10-06 11:08:05 -07:00
tiny.c rcu: Use rcu_callback_t in call_rcu*() and friends 2015-10-06 11:08:05 -07:00
tiny_plugin.h rcu: Convert ACCESS_ONCE() to READ_ONCE() and WRITE_ONCE() 2015-05-27 12:56:15 -07:00
tree.c rcu: Don't disable preemption for Tiny and Tree RCU readers 2015-10-06 11:08:23 -07:00
tree.h rcu: Use call_rcu_func_t to replace explicit type equivalents 2015-10-06 11:08:19 -07:00
tree_plugin.h rcu: Use rcu_callback_t in call_rcu*() and friends 2015-10-06 11:08:05 -07:00
tree_trace.c rcu: Add fastpath bypassing funnel locking 2015-07-17 14:59:06 -07:00
update.c rcu: Use rcu_callback_t in call_rcu*() and friends 2015-10-06 11:08:05 -07:00