diff options
Diffstat (limited to 'include/linux/srcu.h')
| -rw-r--r-- | include/linux/srcu.h | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 6eb691b08358..04f4121a23ae 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -151,30 +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 | * | ||
| 167 | * Similarly, we avoid claiming an SRCU read lock held if the current | ||
| 168 | * CPU is offline. | ||
| 169 | */ | 157 | */ |
| 170 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | 158 | static inline int srcu_read_lock_held(struct srcu_struct *sp) |
| 171 | { | 159 | { |
| 172 | if (!debug_lockdep_rcu_enabled()) | 160 | if (!debug_lockdep_rcu_enabled()) |
| 173 | return 1; | 161 | return 1; |
| 174 | if (rcu_is_cpu_idle()) | ||
| 175 | return 0; | ||
| 176 | if (!rcu_lockdep_current_cpu_online()) | ||
| 177 | return 0; | ||
| 178 | return lock_is_held(&sp->dep_map); | 162 | return lock_is_held(&sp->dep_map); |
| 179 | } | 163 | } |
| 180 | 164 | ||
| @@ -236,8 +220,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 236 | int retval = __srcu_read_lock(sp); | 220 | int retval = __srcu_read_lock(sp); |
| 237 | 221 | ||
| 238 | rcu_lock_acquire(&(sp)->dep_map); | 222 | rcu_lock_acquire(&(sp)->dep_map); |
| 239 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 240 | "srcu_read_lock() used illegally while idle"); | ||
| 241 | return retval; | 223 | return retval; |
| 242 | } | 224 | } |
| 243 | 225 | ||
| @@ -251,8 +233,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 251 | 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) |
| 252 | __releases(sp) | 234 | __releases(sp) |
| 253 | { | 235 | { |
| 254 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 255 | "srcu_read_unlock() used illegally while idle"); | ||
| 256 | rcu_lock_release(&(sp)->dep_map); | 236 | rcu_lock_release(&(sp)->dep_map); |
| 257 | __srcu_read_unlock(sp, idx); | 237 | __srcu_read_unlock(sp, idx); |
| 258 | } | 238 | } |
