Skip to content

Commit aacb5d9

Browse files
author
Paul E. McKenney
committed
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>
1 parent eb4c238 commit aacb5d9

5 files changed

Lines changed: 359 additions & 359 deletions

File tree

‎include/linux/srcu.h‎

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ struct srcu_struct;
3838

3939
#ifdef CONFIG_DEBUG_LOCK_ALLOC
4040

41-
int __init_srcu_struct(struct srcu_struct *sp, const char *name,
41+
int __init_srcu_struct(struct srcu_struct *ssp, const char *name,
4242
struct lock_class_key *key);
4343

44-
#define init_srcu_struct(sp) \
44+
#define init_srcu_struct(ssp) \
4545
({ \
4646
static struct lock_class_key __srcu_key; \
4747
\
48-
__init_srcu_struct((sp), #sp, &__srcu_key); \
48+
__init_srcu_struct((ssp), #ssp, &__srcu_key); \
4949
})
5050

5151
#define __SRCU_DEP_MAP_INIT(srcu_name) .dep_map = { .name = #srcu_name },
5252
#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
5353

54-
int init_srcu_struct(struct srcu_struct *sp);
54+
int init_srcu_struct(struct srcu_struct *ssp);
5555

5656
#define __SRCU_DEP_MAP_INIT(srcu_name)
5757
#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
@@ -67,28 +67,28 @@ int init_srcu_struct(struct srcu_struct *sp);
6767
struct srcu_struct { };
6868
#endif
6969

70-
void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
70+
void call_srcu(struct srcu_struct *ssp, struct rcu_head *head,
7171
void (*func)(struct rcu_head *head));
72-
void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced);
73-
int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
74-
void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
75-
void synchronize_srcu(struct srcu_struct *sp);
72+
void _cleanup_srcu_struct(struct srcu_struct *ssp, bool quiesced);
73+
int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp);
74+
void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp);
75+
void synchronize_srcu(struct srcu_struct *ssp);
7676

7777
/**
7878
* cleanup_srcu_struct - deconstruct a sleep-RCU structure
79-
* @sp: structure to clean up.
79+
* @ssp: structure to clean up.
8080
*
8181
* Must invoke this after you are finished using a given srcu_struct that
8282
* was initialized via init_srcu_struct(), else you leak memory.
8383
*/
84-
static inline void cleanup_srcu_struct(struct srcu_struct *sp)
84+
static inline void cleanup_srcu_struct(struct srcu_struct *ssp)
8585
{
86-
_cleanup_srcu_struct(sp, false);
86+
_cleanup_srcu_struct(ssp, false);
8787
}
8888

8989
/**
9090
* cleanup_srcu_struct_quiesced - deconstruct a quiesced sleep-RCU structure
91-
* @sp: structure to clean up.
91+
* @ssp: structure to clean up.
9292
*
9393
* Must invoke this after you are finished using a given srcu_struct that
9494
* 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)
103103
* (with high probability, anyway), and will also cause the srcu_struct
104104
* to be leaked.
105105
*/
106-
static inline void cleanup_srcu_struct_quiesced(struct srcu_struct *sp)
106+
static inline void cleanup_srcu_struct_quiesced(struct srcu_struct *ssp)
107107
{
108-
_cleanup_srcu_struct(sp, true);
108+
_cleanup_srcu_struct(ssp, true);
109109
}
110110

111111
#ifdef CONFIG_DEBUG_LOCK_ALLOC
112112

113113
/**
114114
* 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
116116
*
117117
* If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU
118118
* 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)
126126
* relies on normal RCU, it can be called from the CPU which
127127
* is in the idle loop from an RCU point of view or offline.
128128
*/
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)
130130
{
131131
if (!debug_lockdep_rcu_enabled())
132132
return 1;
133-
return lock_is_held(&sp->dep_map);
133+
return lock_is_held(&ssp->dep_map);
134134
}
135135

136136
#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
137137

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)
139139
{
140140
return 1;
141141
}
@@ -145,7 +145,7 @@ static inline int srcu_read_lock_held(const struct srcu_struct *sp)
145145
/**
146146
* srcu_dereference_check - fetch SRCU-protected pointer for later dereferencing
147147
* @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
149149
* really are in an SRCU read-side critical section.
150150
* @c: condition to check for update-side use
151151
*
@@ -154,32 +154,32 @@ static inline int srcu_read_lock_held(const struct srcu_struct *sp)
154154
* to 1. The @c argument will normally be a logical expression containing
155155
* lockdep_is_held() calls.
156156
*/
157-
#define srcu_dereference_check(p, sp, c) \
158-
__rcu_dereference_check((p), (c) || srcu_read_lock_held(sp), __rcu)
157+
#define srcu_dereference_check(p, ssp, c) \
158+
__rcu_dereference_check((p), (c) || srcu_read_lock_held(ssp), __rcu)
159159

160160
/**
161161
* srcu_dereference - fetch SRCU-protected pointer for later dereferencing
162162
* @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
164164
* really are in an SRCU read-side critical section.
165165
*
166166
* Makes rcu_dereference_check() do the dirty work. If PROVE_RCU
167167
* is enabled, invoking this outside of an RCU read-side critical
168168
* section will result in an RCU-lockdep splat.
169169
*/
170-
#define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0)
170+
#define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
171171

172172
/**
173173
* srcu_dereference_notrace - no tracing and no lockdep calls from here
174174
* @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
176176
* really are in an SRCU read-side critical section.
177177
*/
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)
179179

180180
/**
181181
* 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.
183183
*
184184
* Enter an SRCU read-side critical section. Note that SRCU read-side
185185
* 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)
194194
* srcu_read_unlock() in an irq handler if the matching srcu_read_lock()
195195
* was invoked in process context.
196196
*/
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)
198198
{
199199
int retval;
200200

201-
retval = __srcu_read_lock(sp);
202-
rcu_lock_acquire(&(sp)->dep_map);
201+
retval = __srcu_read_lock(ssp);
202+
rcu_lock_acquire(&(ssp)->dep_map);
203203
return retval;
204204
}
205205

206206
/* Used by tracing, cannot be traced and cannot invoke lockdep. */
207207
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)
209209
{
210210
int retval;
211211

212-
retval = __srcu_read_lock(sp);
212+
retval = __srcu_read_lock(ssp);
213213
return retval;
214214
}
215215

216216
/**
217217
* 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.
219219
* @idx: return value from corresponding srcu_read_lock().
220220
*
221221
* Exit an SRCU read-side critical section.
222222
*/
223-
static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
224-
__releases(sp)
223+
static inline void srcu_read_unlock(struct srcu_struct *ssp, int idx)
224+
__releases(ssp)
225225
{
226-
rcu_lock_release(&(sp)->dep_map);
227-
__srcu_read_unlock(sp, idx);
226+
rcu_lock_release(&(ssp)->dep_map);
227+
__srcu_read_unlock(ssp, idx);
228228
}
229229

230230
/* Used by tracing, cannot be traced and cannot call lockdep. */
231231
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)
233233
{
234-
__srcu_read_unlock(sp, idx);
234+
__srcu_read_unlock(ssp, idx);
235235
}
236236

237237
/**

‎include/linux/srcutiny.h‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,44 @@ void srcu_drive_gp(struct work_struct *wp);
6060
#define DEFINE_STATIC_SRCU(name) \
6161
static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name)
6262

63-
void synchronize_srcu(struct srcu_struct *sp);
63+
void synchronize_srcu(struct srcu_struct *ssp);
6464

6565
/*
6666
* Counts the new reader in the appropriate per-CPU element of the
6767
* srcu_struct. Can be invoked from irq/bh handlers, but the matching
6868
* __srcu_read_unlock() must be in the same handler instance. Returns an
6969
* index that must be passed to the matching srcu_read_unlock().
7070
*/
71-
static inline int __srcu_read_lock(struct srcu_struct *sp)
71+
static inline int __srcu_read_lock(struct srcu_struct *ssp)
7272
{
7373
int idx;
7474

75-
idx = READ_ONCE(sp->srcu_idx);
76-
WRITE_ONCE(sp->srcu_lock_nesting[idx], sp->srcu_lock_nesting[idx] + 1);
75+
idx = READ_ONCE(ssp->srcu_idx);
76+
WRITE_ONCE(ssp->srcu_lock_nesting[idx], ssp->srcu_lock_nesting[idx] + 1);
7777
return idx;
7878
}
7979

80-
static inline void synchronize_srcu_expedited(struct srcu_struct *sp)
80+
static inline void synchronize_srcu_expedited(struct srcu_struct *ssp)
8181
{
82-
synchronize_srcu(sp);
82+
synchronize_srcu(ssp);
8383
}
8484

85-
static inline void srcu_barrier(struct srcu_struct *sp)
85+
static inline void srcu_barrier(struct srcu_struct *ssp)
8686
{
87-
synchronize_srcu(sp);
87+
synchronize_srcu(ssp);
8888
}
8989

9090
/* Defined here to avoid size increase for non-torture kernels. */
91-
static inline void srcu_torture_stats_print(struct srcu_struct *sp,
91+
static inline void srcu_torture_stats_print(struct srcu_struct *ssp,
9292
char *tt, char *tf)
9393
{
9494
int idx;
9595

96-
idx = READ_ONCE(sp->srcu_idx) & 0x1;
96+
idx = READ_ONCE(ssp->srcu_idx) & 0x1;
9797
pr_alert("%s%s Tiny SRCU per-CPU(idx=%d): (%hd,%hd)\n",
9898
tt, tf, idx,
99-
READ_ONCE(sp->srcu_lock_nesting[!idx]),
100-
READ_ONCE(sp->srcu_lock_nesting[idx]));
99+
READ_ONCE(ssp->srcu_lock_nesting[!idx]),
100+
READ_ONCE(ssp->srcu_lock_nesting[idx]));
101101
}
102102

103103
#endif

‎include/linux/srcutree.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct srcu_data {
5151
unsigned long grpmask; /* Mask for leaf srcu_node */
5252
/* ->srcu_data_have_cbs[]. */
5353
int cpu;
54-
struct srcu_struct *sp;
54+
struct srcu_struct *ssp;
5555
};
5656

5757
/*
@@ -138,8 +138,8 @@ struct srcu_struct {
138138
#define DEFINE_SRCU(name) __DEFINE_SRCU(name, /* not static */)
139139
#define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, static)
140140

141-
void synchronize_srcu_expedited(struct srcu_struct *sp);
142-
void srcu_barrier(struct srcu_struct *sp);
143-
void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf);
141+
void synchronize_srcu_expedited(struct srcu_struct *ssp);
142+
void srcu_barrier(struct srcu_struct *ssp);
143+
void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf);
144144

145145
#endif

0 commit comments

Comments
 (0)