diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2012-11-29 03:46:06 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-02-07 18:15:00 -0500 |
commit | 511a0868bed6694512348fc177cdfaf3fd97d0bb (patch) | |
tree | 2875f25752a987492ce88169177dfae857542d9d | |
parent | 3bc97a782cc8c112f64a25143452b06206364cc8 (diff) |
srcu: Remove checks preventing idle CPUs from calling srcu_read_lock()
SRCU has its own statemachine and no longer relies on normal RCU.
Its read-side critical section can now be used by an offline CPU, so this
commit removes the check and the comments, reverting the SRCU portion
of ff195cb6 (rcu: Warn when srcu_read_lock() is used in an extended
quiescent state).
It also makes the codes match the comments in whatisRCU.txt:
g. Do you need read-side critical sections that are respected
even though they are in the middle of the idle loop, during
user-mode execution, or on an offlined CPU? If so, SRCU is the
only choice that will work for you.
[ paulmck: There is at least one remaining issue, namely use of lockdep
with tracing enabled. ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | include/linux/srcu.h | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index ae3ee39eb699..04f4121a23ae 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
@@ -151,25 +151,14 @@ void srcu_barrier(struct srcu_struct *sp); | |||
151 | * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot | 151 | * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot |
152 | * and while lockdep is disabled. | 152 | * and while lockdep is disabled. |
153 | * | 153 | * |
154 | * Note that if the CPU is in the idle loop from an RCU point of view | 154 | * Note that SRCU is based on its own statemachine and it doesn't |
155 | * (ie: that we are in the section between rcu_idle_enter() and | 155 | * relies on normal RCU, it can be called from the CPU which |
156 | * rcu_idle_exit()) then srcu_read_lock_held() returns false even if | 156 | * is in the idle loop from an RCU point of view or offline. |
157 | * the CPU did an srcu_read_lock(). The reason for this is that RCU | ||
158 | * ignores CPUs that are in such a section, considering these as in | ||
159 | * extended quiescent state, so such a CPU is effectively never in an | ||
160 | * RCU read-side critical section regardless of what RCU primitives it | ||
161 | * invokes. This state of affairs is required --- we need to keep an | ||
162 | * RCU-free window in idle where the CPU may possibly enter into low | ||
163 | * power mode. This way we can notice an extended quiescent state to | ||
164 | * other CPUs that started a grace period. Otherwise we would delay any | ||
165 | * grace period as long as we run in the idle task. | ||
166 | */ | 157 | */ |
167 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | 158 | static inline int srcu_read_lock_held(struct srcu_struct *sp) |
168 | { | 159 | { |
169 | if (!debug_lockdep_rcu_enabled()) | 160 | if (!debug_lockdep_rcu_enabled()) |
170 | return 1; | 161 | return 1; |
171 | if (rcu_is_cpu_idle()) | ||
172 | return 0; | ||
173 | return lock_is_held(&sp->dep_map); | 162 | return lock_is_held(&sp->dep_map); |
174 | } | 163 | } |
175 | 164 | ||
@@ -231,8 +220,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
231 | int retval = __srcu_read_lock(sp); | 220 | int retval = __srcu_read_lock(sp); |
232 | 221 | ||
233 | rcu_lock_acquire(&(sp)->dep_map); | 222 | rcu_lock_acquire(&(sp)->dep_map); |
234 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
235 | "srcu_read_lock() used illegally while idle"); | ||
236 | return retval; | 223 | return retval; |
237 | } | 224 | } |
238 | 225 | ||
@@ -246,8 +233,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
246 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | 233 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) |
247 | __releases(sp) | 234 | __releases(sp) |
248 | { | 235 | { |
249 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
250 | "srcu_read_unlock() used illegally while idle"); | ||
251 | rcu_lock_release(&(sp)->dep_map); | 236 | rcu_lock_release(&(sp)->dep_map); |
252 | __srcu_read_unlock(sp, idx); | 237 | __srcu_read_unlock(sp, idx); |
253 | } | 238 | } |