rcu: Don't disable preemption for Tiny and Tree RCU readers
RFC PATCH 1/1 rcu: Don't disable preemption for Tiny and Tree RCU readers
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 (though probably not significantly).
This commit therefore removes the preempt_disable() and preempt_enable() from the non-preemptible implementations of __rcu_read_lock() and __rcu_read_unlock(), respectively.
Signed-off-by Paul E. McKenney <[email protected]>
include/linux/rcupdate.h +4 -2
@@ -298,12 +298,14 @@ void synchronize_rcu(void);static inline void __rcu_read_lock (void ) { -preempt_disable (); +if (!IS_ENABLED (CONFIG_TINY_RCU )) +preempt_disable (); }static inline void __rcu_read_unlock (void ) { -preempt_enable (); +if (!IS_ENABLED (CONFIG_TINY_RCU )) +preempt_enable (); }static inline void synchronize_rcu (void )