diff options
| author | Paul E. McKenney <paulmck@linux.ibm.com> | 2018-10-28 13:32:51 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.ibm.com> | 2018-11-27 12:24:17 -0500 |
| commit | aacb5d91ab1bfbb0e8123da59a2e333d52ba7f60 (patch) | |
| tree | e2bd60b0705ff2e11225cef94daa8fca0211bb09 /include/linux/srcu.h | |
| parent | eb4c2382272ae7ae5d81fdfa5b7a6c86146eaaa4 (diff) | |
srcu: Use "ssp" instead of "sp" for srcu_struct pointer
In RCU, the distinction between "rsp", "rnp", and "rdp" has served well
for a great many years, but in SRCU, "sp" vs. "sdp" has proven confusing.
This commit therefore renames SRCU's "sp" pointers to "ssp", so that there
is "ssp" for srcu_struct pointer, "snp" for srcu_node pointer, and "sdp"
for srcu_data pointer.
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Diffstat (limited to 'include/linux/srcu.h')
| -rw-r--r-- | include/linux/srcu.h | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index ebd5f1511690..c614375cd264 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -38,20 +38,20 @@ struct srcu_struct; | |||
| 38 | 38 | ||
| 39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 40 | 40 | ||
| 41 | int __init_srcu_struct(struct srcu_struct *sp, const char *name, | 41 | int __init_srcu_struct(struct srcu_struct *ssp, const char *name, |
| 42 | struct lock_class_key *key); | 42 | struct lock_class_key *key); |
| 43 | 43 | ||
| 44 | #define init_srcu_struct(sp) \ | 44 | #define init_srcu_struct(ssp) \ |
| 45 | ({ \ | 45 | ({ \ |
| 46 | static struct lock_class_key __srcu_key; \ | 46 | static struct lock_class_key __srcu_key; \ |
| 47 | \ | 47 | \ |
| 48 | __init_srcu_struct((sp), #sp, &__srcu_key); \ | 48 | __init_srcu_struct((ssp), #ssp, &__srcu_key); \ |
| 49 | }) | 49 | }) |
| 50 | 50 | ||
| 51 | #define __SRCU_DEP_MAP_INIT(srcu_name) .dep_map = { .name = #srcu_name }, | 51 | #define __SRCU_DEP_MAP_INIT(srcu_name) .dep_map = { .name = #srcu_name }, |
| 52 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | 52 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
| 53 | 53 | ||
| 54 | int init_srcu_struct(struct srcu_struct *sp); | 54 | int init_srcu_struct(struct srcu_struct *ssp); |
| 55 | 55 | ||
| 56 | #define __SRCU_DEP_MAP_INIT(srcu_name) | 56 | #define __SRCU_DEP_MAP_INIT(srcu_name) |
| 57 | #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | 57 | #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
| @@ -67,28 +67,28 @@ int init_srcu_struct(struct srcu_struct *sp); | |||
| 67 | struct srcu_struct { }; | 67 | struct srcu_struct { }; |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | void call_srcu(struct srcu_struct *sp, struct rcu_head *head, | 70 | void call_srcu(struct srcu_struct *ssp, struct rcu_head *head, |
| 71 | void (*func)(struct rcu_head *head)); | 71 | void (*func)(struct rcu_head *head)); |
| 72 | void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced); | 72 | void _cleanup_srcu_struct(struct srcu_struct *ssp, bool quiesced); |
| 73 | int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp); | 73 | int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp); |
| 74 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); | 74 | void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp); |
| 75 | void synchronize_srcu(struct srcu_struct *sp); | 75 | void synchronize_srcu(struct srcu_struct *ssp); |
| 76 | 76 | ||
| 77 | /** | 77 | /** |
| 78 | * cleanup_srcu_struct - deconstruct a sleep-RCU structure | 78 | * cleanup_srcu_struct - deconstruct a sleep-RCU structure |
| 79 | * @sp: structure to clean up. | 79 | * @ssp: structure to clean up. |
| 80 | * | 80 | * |
| 81 | * Must invoke this after you are finished using a given srcu_struct that | 81 | * Must invoke this after you are finished using a given srcu_struct that |
| 82 | * was initialized via init_srcu_struct(), else you leak memory. | 82 | * was initialized via init_srcu_struct(), else you leak memory. |
| 83 | */ | 83 | */ |
| 84 | static inline void cleanup_srcu_struct(struct srcu_struct *sp) | 84 | static inline void cleanup_srcu_struct(struct srcu_struct *ssp) |
| 85 | { | 85 | { |
| 86 | _cleanup_srcu_struct(sp, false); | 86 | _cleanup_srcu_struct(ssp, false); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /** | 89 | /** |
| 90 | * cleanup_srcu_struct_quiesced - deconstruct a quiesced sleep-RCU structure | 90 | * cleanup_srcu_struct_quiesced - deconstruct a quiesced sleep-RCU structure |
| 91 | * @sp: structure to clean up. | 91 | * @ssp: structure to clean up. |
| 92 | * | 92 | * |
| 93 | * Must invoke this after you are finished using a given srcu_struct that | 93 | * Must invoke this after you are finished using a given srcu_struct that |
| 94 | * was initialized via init_srcu_struct(), else you leak memory. Also, | 94 | * was initialized via init_srcu_struct(), else you leak memory. Also, |
| @@ -103,16 +103,16 @@ static inline void cleanup_srcu_struct(struct srcu_struct *sp) | |||
| 103 | * (with high probability, anyway), and will also cause the srcu_struct | 103 | * (with high probability, anyway), and will also cause the srcu_struct |
| 104 | * to be leaked. | 104 | * to be leaked. |
| 105 | */ | 105 | */ |
| 106 | static inline void cleanup_srcu_struct_quiesced(struct srcu_struct *sp) | 106 | static inline void cleanup_srcu_struct_quiesced(struct srcu_struct *ssp) |
| 107 | { | 107 | { |
| 108 | _cleanup_srcu_struct(sp, true); | 108 | _cleanup_srcu_struct(ssp, true); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 111 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 112 | 112 | ||
| 113 | /** | 113 | /** |
| 114 | * srcu_read_lock_held - might we be in SRCU read-side critical section? | 114 | * srcu_read_lock_held - might we be in SRCU read-side critical section? |
| 115 | * @sp: The srcu_struct structure to check | 115 | * @ssp: The srcu_struct structure to check |
| 116 | * | 116 | * |
| 117 | * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU | 117 | * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU |
| 118 | * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC, | 118 | * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC, |
| @@ -126,16 +126,16 @@ static inline void cleanup_srcu_struct_quiesced(struct srcu_struct *sp) | |||
| 126 | * relies on normal RCU, it can be called from the CPU which | 126 | * relies on normal RCU, it can be called from the CPU which |
| 127 | * is in the idle loop from an RCU point of view or offline. | 127 | * is in the idle loop from an RCU point of view or offline. |
| 128 | */ | 128 | */ |
| 129 | static inline int srcu_read_lock_held(const struct srcu_struct *sp) | 129 | static inline int srcu_read_lock_held(const struct srcu_struct *ssp) |
| 130 | { | 130 | { |
| 131 | if (!debug_lockdep_rcu_enabled()) | 131 | if (!debug_lockdep_rcu_enabled()) |
| 132 | return 1; | 132 | return 1; |
| 133 | return lock_is_held(&sp->dep_map); | 133 | return lock_is_held(&ssp->dep_map); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ | 136 | #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ |
| 137 | 137 | ||
| 138 | static inline int srcu_read_lock_held(const struct srcu_struct *sp) | 138 | static inline int srcu_read_lock_held(const struct srcu_struct *ssp) |
| 139 | { | 139 | { |
| 140 | return 1; | 140 | return 1; |
| 141 | } | 141 | } |
| @@ -145,7 +145,7 @@ static inline int srcu_read_lock_held(const struct srcu_struct *sp) | |||
| 145 | /** | 145 | /** |
| 146 | * srcu_dereference_check - fetch SRCU-protected pointer for later dereferencing | 146 | * srcu_dereference_check - fetch SRCU-protected pointer for later dereferencing |
| 147 | * @p: the pointer to fetch and protect for later dereferencing | 147 | * @p: the pointer to fetch and protect for later dereferencing |
| 148 | * @sp: pointer to the srcu_struct, which is used to check that we | 148 | * @ssp: pointer to the srcu_struct, which is used to check that we |
| 149 | * really are in an SRCU read-side critical section. | 149 | * really are in an SRCU read-side critical section. |
| 150 | * @c: condition to check for update-side use | 150 | * @c: condition to check for update-side use |
| 151 | * | 151 | * |
| @@ -154,32 +154,32 @@ static inline int srcu_read_lock_held(const struct srcu_struct *sp) | |||
| 154 | * to 1. The @c argument will normally be a logical expression containing | 154 | * to 1. The @c argument will normally be a logical expression containing |
| 155 | * lockdep_is_held() calls. | 155 | * lockdep_is_held() calls. |
| 156 | */ | 156 | */ |
| 157 | #define srcu_dereference_check(p, sp, c) \ | 157 | #define srcu_dereference_check(p, ssp, c) \ |
| 158 | __rcu_dereference_check((p), (c) || srcu_read_lock_held(sp), __rcu) | 158 | __rcu_dereference_check((p), (c) || srcu_read_lock_held(ssp), __rcu) |
| 159 | 159 | ||
| 160 | /** | 160 | /** |
| 161 | * srcu_dereference - fetch SRCU-protected pointer for later dereferencing | 161 | * srcu_dereference - fetch SRCU-protected pointer for later dereferencing |
| 162 | * @p: the pointer to fetch and protect for later dereferencing | 162 | * @p: the pointer to fetch and protect for later dereferencing |
| 163 | * @sp: pointer to the srcu_struct, which is used to check that we | 163 | * @ssp: pointer to the srcu_struct, which is used to check that we |
| 164 | * really are in an SRCU read-side critical section. | 164 | * really are in an SRCU read-side critical section. |
| 165 | * | 165 | * |
| 166 | * Makes rcu_dereference_check() do the dirty work. If PROVE_RCU | 166 | * Makes rcu_dereference_check() do the dirty work. If PROVE_RCU |
| 167 | * is enabled, invoking this outside of an RCU read-side critical | 167 | * is enabled, invoking this outside of an RCU read-side critical |
| 168 | * section will result in an RCU-lockdep splat. | 168 | * section will result in an RCU-lockdep splat. |
| 169 | */ | 169 | */ |
| 170 | #define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0) | 170 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0) |
| 171 | 171 | ||
| 172 | /** | 172 | /** |
| 173 | * srcu_dereference_notrace - no tracing and no lockdep calls from here | 173 | * srcu_dereference_notrace - no tracing and no lockdep calls from here |
| 174 | * @p: the pointer to fetch and protect for later dereferencing | 174 | * @p: the pointer to fetch and protect for later dereferencing |
| 175 | * @sp: pointer to the srcu_struct, which is used to check that we | 175 | * @ssp: pointer to the srcu_struct, which is used to check that we |
| 176 | * really are in an SRCU read-side critical section. | 176 | * really are in an SRCU read-side critical section. |
| 177 | */ | 177 | */ |
| 178 | #define srcu_dereference_notrace(p, sp) srcu_dereference_check((p), (sp), 1) | 178 | #define srcu_dereference_notrace(p, ssp) srcu_dereference_check((p), (ssp), 1) |
| 179 | 179 | ||
| 180 | /** | 180 | /** |
| 181 | * srcu_read_lock - register a new reader for an SRCU-protected structure. | 181 | * srcu_read_lock - register a new reader for an SRCU-protected structure. |
| 182 | * @sp: srcu_struct in which to register the new reader. | 182 | * @ssp: srcu_struct in which to register the new reader. |
| 183 | * | 183 | * |
| 184 | * Enter an SRCU read-side critical section. Note that SRCU read-side | 184 | * Enter an SRCU read-side critical section. Note that SRCU read-side |
| 185 | * critical sections may be nested. However, it is illegal to | 185 | * critical sections may be nested. However, it is illegal to |
| @@ -194,44 +194,44 @@ static inline int srcu_read_lock_held(const struct srcu_struct *sp) | |||
| 194 | * srcu_read_unlock() in an irq handler if the matching srcu_read_lock() | 194 | * srcu_read_unlock() in an irq handler if the matching srcu_read_lock() |
| 195 | * was invoked in process context. | 195 | * was invoked in process context. |
| 196 | */ | 196 | */ |
| 197 | static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | 197 | static inline int srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp) |
| 198 | { | 198 | { |
| 199 | int retval; | 199 | int retval; |
| 200 | 200 | ||
| 201 | retval = __srcu_read_lock(sp); | 201 | retval = __srcu_read_lock(ssp); |
| 202 | rcu_lock_acquire(&(sp)->dep_map); | 202 | rcu_lock_acquire(&(ssp)->dep_map); |
| 203 | return retval; | 203 | return retval; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | /* Used by tracing, cannot be traced and cannot invoke lockdep. */ | 206 | /* Used by tracing, cannot be traced and cannot invoke lockdep. */ |
| 207 | static inline notrace int | 207 | static inline notrace int |
| 208 | srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp) | 208 | srcu_read_lock_notrace(struct srcu_struct *ssp) __acquires(ssp) |
| 209 | { | 209 | { |
| 210 | int retval; | 210 | int retval; |
| 211 | 211 | ||
| 212 | retval = __srcu_read_lock(sp); | 212 | retval = __srcu_read_lock(ssp); |
| 213 | return retval; | 213 | return retval; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | /** | 216 | /** |
| 217 | * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. | 217 | * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. |
| 218 | * @sp: srcu_struct in which to unregister the old reader. | 218 | * @ssp: srcu_struct in which to unregister the old reader. |
| 219 | * @idx: return value from corresponding srcu_read_lock(). | 219 | * @idx: return value from corresponding srcu_read_lock(). |
| 220 | * | 220 | * |
| 221 | * Exit an SRCU read-side critical section. | 221 | * Exit an SRCU read-side critical section. |
| 222 | */ | 222 | */ |
| 223 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | 223 | static inline void srcu_read_unlock(struct srcu_struct *ssp, int idx) |
| 224 | __releases(sp) | 224 | __releases(ssp) |
| 225 | { | 225 | { |
| 226 | rcu_lock_release(&(sp)->dep_map); | 226 | rcu_lock_release(&(ssp)->dep_map); |
| 227 | __srcu_read_unlock(sp, idx); | 227 | __srcu_read_unlock(ssp, idx); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | /* Used by tracing, cannot be traced and cannot call lockdep. */ | 230 | /* Used by tracing, cannot be traced and cannot call lockdep. */ |
| 231 | static inline notrace void | 231 | static inline notrace void |
| 232 | srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp) | 232 | srcu_read_unlock_notrace(struct srcu_struct *ssp, int idx) __releases(ssp) |
| 233 | { | 233 | { |
| 234 | __srcu_read_unlock(sp, idx); | 234 | __srcu_read_unlock(ssp, idx); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | /** | 237 | /** |
