diff options
Diffstat (limited to 'include/linux/srcu.h')
| -rw-r--r-- | include/linux/srcu.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index e1b005918bbb..d3d5fa54f25e 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -99,15 +99,18 @@ long srcu_batches_completed(struct srcu_struct *sp); | |||
| 99 | * power mode. This way we can notice an extended quiescent state to | 99 | * power mode. This way we can notice an extended quiescent state to |
| 100 | * other CPUs that started a grace period. Otherwise we would delay any | 100 | * other CPUs that started a grace period. Otherwise we would delay any |
| 101 | * grace period as long as we run in the idle task. | 101 | * grace period as long as we run in the idle task. |
| 102 | * | ||
| 103 | * Similarly, we avoid claiming an SRCU read lock held if the current | ||
| 104 | * CPU is offline. | ||
| 102 | */ | 105 | */ |
| 103 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | 106 | static inline int srcu_read_lock_held(struct srcu_struct *sp) |
| 104 | { | 107 | { |
| 105 | if (rcu_is_cpu_idle()) | ||
| 106 | return 0; | ||
| 107 | |||
| 108 | if (!debug_lockdep_rcu_enabled()) | 108 | if (!debug_lockdep_rcu_enabled()) |
| 109 | return 1; | 109 | return 1; |
| 110 | 110 | if (rcu_is_cpu_idle()) | |
| 111 | return 0; | ||
| 112 | if (!rcu_lockdep_current_cpu_online()) | ||
| 113 | return 0; | ||
| 111 | return lock_is_held(&sp->dep_map); | 114 | return lock_is_held(&sp->dep_map); |
| 112 | } | 115 | } |
| 113 | 116 | ||
| @@ -169,6 +172,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 169 | int retval = __srcu_read_lock(sp); | 172 | int retval = __srcu_read_lock(sp); |
| 170 | 173 | ||
| 171 | rcu_lock_acquire(&(sp)->dep_map); | 174 | rcu_lock_acquire(&(sp)->dep_map); |
| 175 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 176 | "srcu_read_lock() used illegally while idle"); | ||
| 172 | return retval; | 177 | return retval; |
| 173 | } | 178 | } |
| 174 | 179 | ||
| @@ -182,6 +187,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 182 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | 187 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) |
| 183 | __releases(sp) | 188 | __releases(sp) |
| 184 | { | 189 | { |
| 190 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 191 | "srcu_read_unlock() used illegally while idle"); | ||
| 185 | rcu_lock_release(&(sp)->dep_map); | 192 | rcu_lock_release(&(sp)->dep_map); |
| 186 | __srcu_read_unlock(sp, idx); | 193 | __srcu_read_unlock(sp, idx); |
| 187 | } | 194 | } |
