Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1196578 > unrolled thread

[PATCH RFC] rcu: Don't disable preemption for Tiny and Tree RCU readers

Started by"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
First post2015-07-31 06:40 +0200
Last post2015-07-31 06:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH RFC] rcu: Don't disable preemption for Tiny and Tree RCU  readers "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-07-31 06:40 +0200

#1196578 — [PATCH RFC] rcu: Don't disable preemption for Tiny and Tree RCU readers

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2015-07-31 06:40 +0200
Subject[PATCH RFC] rcu: Don't disable preemption for Tiny and Tree RCU readers
Message-ID<pSagV-3gr-1@gated-at.bofh.it>
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 <paulmck@linux.vnet.ibm.com>

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 78af46c98e55..927c5e60c1dd 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -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)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web