History

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.

Paul E. McKenney committed 8 years ago

Commit aacb5d91 parent eb4c2385 files · +359 −359Browse files

Unified · Split

5 files
  1. include/linux/srcu.h +39 −39
  2. include/linux/srcutiny.h +12 −12
  3. include/linux/srcutree.h +4 −4
  4. kernel/rcu/srcutiny.c +60 −60
  5. kernel/rcu/srcutree.c +244 −244
include/linux/srcu.h+39−39
@@ -38,20 +38,20 @@ struct srcu_struct; · 37 unmodified lines
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); · 9 unmodified lines
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) · 8 unmodified lines
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) · 7 unmodified lines
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) · 3 unmodified lines
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) · 2 unmodified lines
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) · 8 unmodified lines
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+12−12
@@ -60,7 +60,7 @@ void srcu_drive_gp(struct work_struct *wp); · 59 unmodified lines
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
@@ -68,36 +68,36 @@ void synchronize_srcu(struct srcu_struct *sp); · 1 unmodified line
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+4−4
@@ -51,7 +51,7 @@ struct srcu_data { · 50 unmodified lines
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 { · 80 unmodified lines
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
kernel/rcu/srcutiny.c+60−60
@@ -37,30 +37,30 @@ int rcu_scheduler_active __read_mostly; · 36 unmodified lines
3737 static LIST_HEAD(srcu_boot_list);
3838 static bool srcu_init_done;
3939
40−static int init_srcu_struct_fields(struct srcu_struct *sp)
40+static int init_srcu_struct_fields(struct srcu_struct *ssp)
4141 {
42− sp->srcu_lock_nesting[0] = 0;
43− sp->srcu_lock_nesting[1] = 0;
44− init_swait_queue_head(&sp->srcu_wq);
45− sp->srcu_cb_head = NULL;
46− sp->srcu_cb_tail = &sp->srcu_cb_head;
47− sp->srcu_gp_running = false;
48− sp->srcu_gp_waiting = false;
49− sp->srcu_idx = 0;
50− INIT_WORK(&sp->srcu_work, srcu_drive_gp);
51− INIT_LIST_HEAD(&sp->srcu_work.entry);
42+ ssp->srcu_lock_nesting[0] = 0;
43+ ssp->srcu_lock_nesting[1] = 0;
44+ init_swait_queue_head(&ssp->srcu_wq);
45+ ssp->srcu_cb_head = NULL;
46+ ssp->srcu_cb_tail = &ssp->srcu_cb_head;
47+ ssp->srcu_gp_running = false;
48+ ssp->srcu_gp_waiting = false;
49+ ssp->srcu_idx = 0;
50+ INIT_WORK(&ssp->srcu_work, srcu_drive_gp);
51+ INIT_LIST_HEAD(&ssp->srcu_work.entry);
5252 return 0;
5353 }
5454
5555 #ifdef CONFIG_DEBUG_LOCK_ALLOC
5656
57−int __init_srcu_struct(struct srcu_struct *sp, const char *name,
57+int __init_srcu_struct(struct srcu_struct *ssp, const char *name,
5858 struct lock_class_key *key)
5959 {
6060 /* Don't re-initialize a lock while it is held. */
61− debug_check_no_locks_freed((void *)sp, sizeof(*sp));
62− lockdep_init_map(&sp->dep_map, name, key, 0);
63− return init_srcu_struct_fields(sp);
61+ debug_check_no_locks_freed((void *)ssp, sizeof(*ssp));
62+ lockdep_init_map(&ssp->dep_map, name, key, 0);
63+ return init_srcu_struct_fields(ssp);
6464 }
6565 EXPORT_SYMBOL_GPL(__init_srcu_struct);
6666
@@ -68,15 +68,15 @@ EXPORT_SYMBOL_GPL(__init_srcu_struct); · 1 unmodified line
6868
6969 /*
7070 * init_srcu_struct - initialize a sleep-RCU structure
71− * @sp: structure to initialize.
71+ * @ssp: structure to initialize.
7272 *
7373 * Must invoke this on a given srcu_struct before passing that srcu_struct
7474 * to any other function. Each srcu_struct represents a separate domain
7575 * of SRCU protection.
7676 */
77−int init_srcu_struct(struct srcu_struct *sp)
77+int init_srcu_struct(struct srcu_struct *ssp)
7878 {
79− return init_srcu_struct_fields(sp);
79+ return init_srcu_struct_fields(ssp);
8080 }
8181 EXPORT_SYMBOL_GPL(init_srcu_struct);
8282
@@ -84,22 +84,22 @@ EXPORT_SYMBOL_GPL(init_srcu_struct); · 1 unmodified line
8484
8585 /*
8686 * cleanup_srcu_struct - deconstruct a sleep-RCU structure
87− * @sp: structure to clean up.
87+ * @ssp: structure to clean up.
8888 *
8989 * Must invoke this after you are finished using a given srcu_struct that
9090 * was initialized via init_srcu_struct(), else you leak memory.
9191 */
92−void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced)
92+void _cleanup_srcu_struct(struct srcu_struct *ssp, bool quiesced)
9393 {
94− WARN_ON(sp->srcu_lock_nesting[0] || sp->srcu_lock_nesting[1]);
94+ WARN_ON(ssp->srcu_lock_nesting[0] || ssp->srcu_lock_nesting[1]);
9595 if (quiesced)
96− WARN_ON(work_pending(&sp->srcu_work));
96+ WARN_ON(work_pending(&ssp->srcu_work));
9797 else
98− flush_work(&sp->srcu_work);
99− WARN_ON(sp->srcu_gp_running);
100− WARN_ON(sp->srcu_gp_waiting);
101− WARN_ON(sp->srcu_cb_head);
102− WARN_ON(&sp->srcu_cb_head != sp->srcu_cb_tail);
98+ flush_work(&ssp->srcu_work);
99+ WARN_ON(ssp->srcu_gp_running);
100+ WARN_ON(ssp->srcu_gp_waiting);
101+ WARN_ON(ssp->srcu_cb_head);
102+ WARN_ON(&ssp->srcu_cb_head != ssp->srcu_cb_tail);
103103 }
104104 EXPORT_SYMBOL_GPL(_cleanup_srcu_struct);
105105
@@ -107,13 +107,13 @@ EXPORT_SYMBOL_GPL(_cleanup_srcu_struct); · 1 unmodified line
107107 * Removes the count for the old reader from the appropriate element of
108108 * the srcu_struct.
109109 */
110−void __srcu_read_unlock(struct srcu_struct *sp, int idx)
110+void __srcu_read_unlock(struct srcu_struct *ssp, int idx)
111111 {
112− int newval = sp->srcu_lock_nesting[idx] - 1;
112+ int newval = ssp->srcu_lock_nesting[idx] - 1;
113113
114− WRITE_ONCE(sp->srcu_lock_nesting[idx], newval);
115− if (!newval && READ_ONCE(sp->srcu_gp_waiting))
116− swake_up_one(&sp->srcu_wq);
114+ WRITE_ONCE(ssp->srcu_lock_nesting[idx], newval);
115+ if (!newval && READ_ONCE(ssp->srcu_gp_waiting))
116+ swake_up_one(&ssp->srcu_wq);
117117 }
118118 EXPORT_SYMBOL_GPL(__srcu_read_unlock);
119119
@@ -127,24 +127,24 @@ void srcu_drive_gp(struct work_struct *wp) · 7 unmodified lines
127127 int idx;
128128 struct rcu_head *lh;
129129 struct rcu_head *rhp;
130− struct srcu_struct *sp;
130+ struct srcu_struct *ssp;
131131
132− sp = container_of(wp, struct srcu_struct, srcu_work);
133− if (sp->srcu_gp_running || !READ_ONCE(sp->srcu_cb_head))
132+ ssp = container_of(wp, struct srcu_struct, srcu_work);
133+ if (ssp->srcu_gp_running || !READ_ONCE(ssp->srcu_cb_head))
134134 return; /* Already running or nothing to do. */
135135
136136 /* Remove recently arrived callbacks and wait for readers. */
137− WRITE_ONCE(sp->srcu_gp_running, true);
137+ WRITE_ONCE(ssp->srcu_gp_running, true);
138138 local_irq_disable();
139− lh = sp->srcu_cb_head;
140− sp->srcu_cb_head = NULL;
141− sp->srcu_cb_tail = &sp->srcu_cb_head;
139+ lh = ssp->srcu_cb_head;
140+ ssp->srcu_cb_head = NULL;
141+ ssp->srcu_cb_tail = &ssp->srcu_cb_head;
142142 local_irq_enable();
143− idx = sp->srcu_idx;
144− WRITE_ONCE(sp->srcu_idx, !sp->srcu_idx);
145− WRITE_ONCE(sp->srcu_gp_waiting, true); /* srcu_read_unlock() wakes! */
146− swait_event_exclusive(sp->srcu_wq, !READ_ONCE(sp->srcu_lock_nesting[idx]));
147− WRITE_ONCE(sp->srcu_gp_waiting, false); /* srcu_read_unlock() cheap. */
143+ idx = ssp->srcu_idx;
144+ WRITE_ONCE(ssp->srcu_idx, !ssp->srcu_idx);
145+ WRITE_ONCE(ssp->srcu_gp_waiting, true); /* srcu_read_unlock() wakes! */
146+ swait_event_exclusive(ssp->srcu_wq, !READ_ONCE(ssp->srcu_lock_nesting[idx]));
147+ WRITE_ONCE(ssp->srcu_gp_waiting, false); /* srcu_read_unlock() cheap. */
148148
149149 /* Invoke the callbacks we removed above. */
150150 while (lh) {
@@ -161,9 +161,9 @@ void srcu_drive_gp(struct work_struct *wp) · 10 unmodified lines
161161 * at interrupt level, but the ->srcu_gp_running checks will
162162 * straighten that out.
163163 */
164− WRITE_ONCE(sp->srcu_gp_running, false);
165− if (READ_ONCE(sp->srcu_cb_head))
166− schedule_work(&sp->srcu_work);
164+ WRITE_ONCE(ssp->srcu_gp_running, false);
165+ if (READ_ONCE(ssp->srcu_cb_head))
166+ schedule_work(&ssp->srcu_work);
167167 }
168168 EXPORT_SYMBOL_GPL(srcu_drive_gp);
169169
@@ -171,7 +171,7 @@ EXPORT_SYMBOL_GPL(srcu_drive_gp); · 1 unmodified line
171171 * Enqueue an SRCU callback on the specified srcu_struct structure,
172172 * initiating grace-period processing if it is not already running.
173173 */
174−void call_srcu(struct srcu_struct *sp, struct rcu_head *rhp,
174+void call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
175175 rcu_callback_t func)
176176 {
177177 unsigned long flags;
@@ -179,14 +179,14 @@ void call_srcu(struct srcu_struct *sp, struct rcu_head *rhp, · 1 unmodified line
179179 rhp->func = func;
180180 rhp->next = NULL;
181181 local_irq_save(flags);
182− *sp->srcu_cb_tail = rhp;
183− sp->srcu_cb_tail = &rhp->next;
182+ *ssp->srcu_cb_tail = rhp;
183+ ssp->srcu_cb_tail = &rhp->next;
184184 local_irq_restore(flags);
185− if (!READ_ONCE(sp->srcu_gp_running)) {
185+ if (!READ_ONCE(ssp->srcu_gp_running)) {
186186 if (likely(srcu_init_done))
187− schedule_work(&sp->srcu_work);
188− else if (list_empty(&sp->srcu_work.entry))
189− list_add(&sp->srcu_work.entry, &srcu_boot_list);
187+ schedule_work(&ssp->srcu_work);
188+ else if (list_empty(&ssp->srcu_work.entry))
189+ list_add(&ssp->srcu_work.entry, &srcu_boot_list);
190190 }
191191 }
192192 EXPORT_SYMBOL_GPL(call_srcu);
@@ -194,13 +194,13 @@ EXPORT_SYMBOL_GPL(call_srcu); · 1 unmodified line
194194 /*
195195 * synchronize_srcu - wait for prior SRCU read-side critical-section completion
196196 */
197−void synchronize_srcu(struct srcu_struct *sp)
197+void synchronize_srcu(struct srcu_struct *ssp)
198198 {
199199 struct rcu_synchronize rs;
200200
201201 init_rcu_head_on_stack(&rs.head);
202202 init_completion(&rs.completion);
203− call_srcu(sp, &rs.head, wakeme_after_rcu);
203+ call_srcu(ssp, &rs.head, wakeme_after_rcu);
204204 wait_for_completion(&rs.completion);
205205 destroy_rcu_head_on_stack(&rs.head);
206206 }
@@ -219,13 +219,13 @@ void __init rcu_scheduler_starting(void) · 12 unmodified lines
219219 */
220220 void __init srcu_init(void)
221221 {
222− struct srcu_struct *sp;
222+ struct srcu_struct *ssp;
223223
224224 srcu_init_done = true;
225225 while (!list_empty(&srcu_boot_list)) {
226− sp = list_first_entry(&srcu_boot_list,
226+ ssp = list_first_entry(&srcu_boot_list,
227227 struct srcu_struct, srcu_work.entry);
228− list_del_init(&sp->srcu_work.entry);
229− schedule_work(&sp->srcu_work);
228+ list_del_init(&ssp->srcu_work.entry);
229+ schedule_work(&ssp->srcu_work);
230230 }
231231 }
kernel/rcu/srcutree.c+244−244
@@ -56,7 +56,7 @@ static LIST_HEAD(srcu_boot_list); · 55 unmodified lines
5656 static bool __read_mostly srcu_init_done;
5757
5858 static void srcu_invoke_callbacks(struct work_struct *work);
59−static void srcu_reschedule(struct srcu_struct *sp, unsigned long delay);
59+static void srcu_reschedule(struct srcu_struct *ssp, unsigned long delay);
6060 static void process_srcu(struct work_struct *work);
6161
6262 /* Wrappers for lock acquisition and release, see raw_spin_lock_rcu_node(). */
@@ -92,7 +92,7 @@ do { \ · 29 unmodified lines
9292 * srcu_read_unlock() running against them. So if the is_static parameter
9393 * is set, don't initialize ->srcu_lock_count[] and ->srcu_unlock_count[].
9494 */
95−static void init_srcu_struct_nodes(struct srcu_struct *sp, bool is_static)
95+static void init_srcu_struct_nodes(struct srcu_struct *ssp, bool is_static)
9696 {
9797 int cpu;
9898 int i;
@@ -103,13 +103,13 @@ static void init_srcu_struct_nodes(struct srcu_struct *sp, bool is_static) · 4 unmodified lines
103103 struct srcu_node *snp_first;
104104
105105 /* Work out the overall tree geometry. */
106− sp->level[0] = &sp->node[0];
106+ ssp->level[0] = &ssp->node[0];
107107 for (i = 1; i < rcu_num_lvls; i++)
108− sp->level[i] = sp->level[i - 1] + num_rcu_lvl[i - 1];
108+ ssp->level[i] = ssp->level[i - 1] + num_rcu_lvl[i - 1];
109109 rcu_init_levelspread(levelspread, num_rcu_lvl);
110110
111111 /* Each pass through this loop initializes one srcu_node structure. */
112− srcu_for_each_node_breadth_first(sp, snp) {
112+ srcu_for_each_node_breadth_first(ssp, snp) {
113113 spin_lock_init(&ACCESS_PRIVATE(snp, lock));
114114 WARN_ON_ONCE(ARRAY_SIZE(snp->srcu_have_cbs) !=
115115 ARRAY_SIZE(snp->srcu_data_have_cbs));
@@ -120,17 +120,17 @@ static void init_srcu_struct_nodes(struct srcu_struct *sp, bool is_static) · 4 unmodified lines
120120 snp->srcu_gp_seq_needed_exp = 0;
121121 snp->grplo = -1;
122122 snp->grphi = -1;
123− if (snp == &sp->node[0]) {
123+ if (snp == &ssp->node[0]) {
124124 /* Root node, special case. */
125125 snp->srcu_parent = NULL;
126126 continue;
127127 }
128128
129129 /* Non-root node. */
130− if (snp == sp->level[level + 1])
130+ if (snp == ssp->level[level + 1])
131131 level++;
132− snp->srcu_parent = sp->level[level - 1] +
133− (snp - sp->level[level]) /
132+ snp->srcu_parent = ssp->level[level - 1] +
133+ (snp - ssp->level[level]) /
134134 levelspread[level - 1];
135135 }
136136
@@ -141,14 +141,14 @@ static void init_srcu_struct_nodes(struct srcu_struct *sp, bool is_static) · 4 unmodified lines
141141 WARN_ON_ONCE(ARRAY_SIZE(sdp->srcu_lock_count) !=
142142 ARRAY_SIZE(sdp->srcu_unlock_count));
143143 level = rcu_num_lvls - 1;
144− snp_first = sp->level[level];
144+ snp_first = ssp->level[level];
145145 for_each_possible_cpu(cpu) {
146− sdp = per_cpu_ptr(sp->sda, cpu);
146+ sdp = per_cpu_ptr(ssp->sda, cpu);
147147 spin_lock_init(&ACCESS_PRIVATE(sdp, lock));
148148 rcu_segcblist_init(&sdp->srcu_cblist);
149149 sdp->srcu_cblist_invoking = false;
150− sdp->srcu_gp_seq_needed = sp->srcu_gp_seq;
151− sdp->srcu_gp_seq_needed_exp = sp->srcu_gp_seq;
150+ sdp->srcu_gp_seq_needed = ssp->srcu_gp_seq;
151+ sdp->srcu_gp_seq_needed_exp = ssp->srcu_gp_seq;
152152 sdp->mynode = &snp_first[cpu / levelspread[level]];
153153 for (snp = sdp->mynode; snp != NULL; snp = snp->srcu_parent) {
154154 if (snp->grplo < 0)
@@ -157,7 +157,7 @@ static void init_srcu_struct_nodes(struct srcu_struct *sp, bool is_static) · 2 unmodified lines
157157 }
158158 sdp->cpu = cpu;
159159 INIT_DELAYED_WORK(&sdp->work, srcu_invoke_callbacks);
160− sdp->sp = sp;
160+ sdp->ssp = ssp;
161161 sdp->grpmask = 1 << (cpu - sdp->mynode->grplo);
162162 if (is_static)
163163 continue;
@@ -176,35 +176,35 @@ static void init_srcu_struct_nodes(struct srcu_struct *sp, bool is_static) · 12 unmodified lines
176176 * parameter is passed through to init_srcu_struct_nodes(), and
177177 * also tells us that ->sda has already been wired up to srcu_data.
178178 */
179−static int init_srcu_struct_fields(struct srcu_struct *sp, bool is_static)
179+static int init_srcu_struct_fields(struct srcu_struct *ssp, bool is_static)
180180 {
181− mutex_init(&sp->srcu_cb_mutex);
182− mutex_init(&sp->srcu_gp_mutex);
183− sp->srcu_idx = 0;
184− sp->srcu_gp_seq = 0;
185− sp->srcu_barrier_seq = 0;
186− mutex_init(&sp->srcu_barrier_mutex);
187− atomic_set(&sp->srcu_barrier_cpu_cnt, 0);
188− INIT_DELAYED_WORK(&sp->work, process_srcu);
181+ mutex_init(&ssp->srcu_cb_mutex);
182+ mutex_init(&ssp->srcu_gp_mutex);
183+ ssp->srcu_idx = 0;
184+ ssp->srcu_gp_seq = 0;
185+ ssp->srcu_barrier_seq = 0;
186+ mutex_init(&ssp->srcu_barrier_mutex);
187+ atomic_set(&ssp->srcu_barrier_cpu_cnt, 0);
188+ INIT_DELAYED_WORK(&ssp->work, process_srcu);
189189 if (!is_static)
190− sp->sda = alloc_percpu(struct srcu_data);
191− init_srcu_struct_nodes(sp, is_static);
192− sp->srcu_gp_seq_needed_exp = 0;
193− sp->srcu_last_gp_end = ktime_get_mono_fast_ns();
194− smp_store_release(&sp->srcu_gp_seq_needed, 0); /* Init done. */
195− return sp->sda ? 0 : -ENOMEM;
190+ ssp->sda = alloc_percpu(struct srcu_data);
191+ init_srcu_struct_nodes(ssp, is_static);
192+ ssp->srcu_gp_seq_needed_exp = 0;
193+ ssp->srcu_last_gp_end = ktime_get_mono_fast_ns();
194+ smp_store_release(&ssp->srcu_gp_seq_needed, 0); /* Init done. */
195+ return ssp->sda ? 0 : -ENOMEM;
196196 }
197197
198198 #ifdef CONFIG_DEBUG_LOCK_ALLOC
199199
200−int __init_srcu_struct(struct srcu_struct *sp, const char *name,
200+int __init_srcu_struct(struct srcu_struct *ssp, const char *name,
201201 struct lock_class_key *key)
202202 {
203203 /* Don't re-initialize a lock while it is held. */
204− debug_check_no_locks_freed((void *)sp, sizeof(*sp));
205− lockdep_init_map(&sp->dep_map, name, key, 0);
206− spin_lock_init(&ACCESS_PRIVATE(sp, lock));
207− return init_srcu_struct_fields(sp, false);
204+ debug_check_no_locks_freed((void *)ssp, sizeof(*ssp));
205+ lockdep_init_map(&ssp->dep_map, name, key, 0);
206+ spin_lock_init(&ACCESS_PRIVATE(ssp, lock));
207+ return init_srcu_struct_fields(ssp, false);
208208 }
209209 EXPORT_SYMBOL_GPL(__init_srcu_struct);
210210
@@ -212,16 +212,16 @@ EXPORT_SYMBOL_GPL(__init_srcu_struct); · 1 unmodified line
212212
213213 /**
214214 * init_srcu_struct - initialize a sleep-RCU structure
215− * @sp: structure to initialize.
215+ * @ssp: structure to initialize.
216216 *
217217 * Must invoke this on a given srcu_struct before passing that srcu_struct
218218 * to any other function. Each srcu_struct represents a separate domain
219219 * of SRCU protection.
220220 */
221−int init_srcu_struct(struct srcu_struct *sp)
221+int init_srcu_struct(struct srcu_struct *ssp)
222222 {
223− spin_lock_init(&ACCESS_PRIVATE(sp, lock));
224− return init_srcu_struct_fields(sp, false);
223+ spin_lock_init(&ACCESS_PRIVATE(ssp, lock));
224+ return init_srcu_struct_fields(ssp, false);
225225 }
226226 EXPORT_SYMBOL_GPL(init_srcu_struct);
227227
@@ -231,37 +231,37 @@ EXPORT_SYMBOL_GPL(init_srcu_struct); · 3 unmodified lines
231231 * First-use initialization of statically allocated srcu_struct
232232 * structure. Wiring up the combining tree is more than can be
233233 * done with compile-time initialization, so this check is added
234− * to each update-side SRCU primitive. Use sp->lock, which -is-
234+ * to each update-side SRCU primitive. Use ssp->lock, which -is-
235235 * compile-time initialized, to resolve races involving multiple
236236 * CPUs trying to garner first-use privileges.
237237 */
238−static void check_init_srcu_struct(struct srcu_struct *sp)
238+static void check_init_srcu_struct(struct srcu_struct *ssp)
239239 {
240240 unsigned long flags;
241241
242242 /* The smp_load_acquire() pairs with the smp_store_release(). */
243− if (!rcu_seq_state(smp_load_acquire(&sp->srcu_gp_seq_needed))) /*^^^*/
243+ if (!rcu_seq_state(smp_load_acquire(&ssp->srcu_gp_seq_needed))) /*^^^*/
244244 return; /* Already initialized. */
245− spin_lock_irqsave_rcu_node(sp, flags);
246− if (!rcu_seq_state(sp->srcu_gp_seq_needed)) {
247− spin_unlock_irqrestore_rcu_node(sp, flags);
245+ spin_lock_irqsave_rcu_node(ssp, flags);
246+ if (!rcu_seq_state(ssp->srcu_gp_seq_needed)) {
247+ spin_unlock_irqrestore_rcu_node(ssp, flags);
248248 return;
249249 }
250− init_srcu_struct_fields(sp, true);
251− spin_unlock_irqrestore_rcu_node(sp, flags);
250+ init_srcu_struct_fields(ssp, true);
251+ spin_unlock_irqrestore_rcu_node(ssp, flags);
252252 }
253253
254254 /*
255255 * Returns approximate total of the readers' ->srcu_lock_count[] values
256256 * for the rank of per-CPU counters specified by idx.
257257 */
258−static unsigned long srcu_readers_lock_idx(struct srcu_struct *sp, int idx)
258+static unsigned long srcu_readers_lock_idx(struct srcu_struct *ssp, int idx)
259259 {
260260 int cpu;
261261 unsigned long sum = 0;
262262
263263 for_each_possible_cpu(cpu) {
264− struct srcu_data *cpuc = per_cpu_ptr(sp->sda, cpu);
264+ struct srcu_data *cpuc = per_cpu_ptr(ssp->sda, cpu);
265265
266266 sum += READ_ONCE(cpuc->srcu_lock_count[idx]);
267267 }
@@ -272,13 +272,13 @@ static unsigned long srcu_readers_lock_idx(struct srcu_struct *sp, int idx) · 4 unmodified lines
272272 * Returns approximate total of the readers' ->srcu_unlock_count[] values
273273 * for the rank of per-CPU counters specified by idx.
274274 */
275−static unsigned long srcu_readers_unlock_idx(struct srcu_struct *sp, int idx)
275+static unsigned long srcu_readers_unlock_idx(struct srcu_struct *ssp, int idx)
276276 {
277277 int cpu;
278278 unsigned long sum = 0;
279279
280280 for_each_possible_cpu(cpu) {
281− struct srcu_data *cpuc = per_cpu_ptr(sp->sda, cpu);
281+ struct srcu_data *cpuc = per_cpu_ptr(ssp->sda, cpu);
282282
283283 sum += READ_ONCE(cpuc->srcu_unlock_count[idx]);
284284 }
@@ -289,11 +289,11 @@ static unsigned long srcu_readers_unlock_idx(struct srcu_struct *sp, int idx) · 4 unmodified lines
289289 * Return true if the number of pre-existing readers is determined to
290290 * be zero.
291291 */
292−static bool srcu_readers_active_idx_check(struct srcu_struct *sp, int idx)
292+static bool srcu_readers_active_idx_check(struct srcu_struct *ssp, int idx)
293293 {
294294 unsigned long unlocks;
295295
296− unlocks = srcu_readers_unlock_idx(sp, idx);
296+ unlocks = srcu_readers_unlock_idx(ssp, idx);
297297
298298 /*
299299 * Make sure that a lock is always counted if the corresponding
@@ -329,25 +329,25 @@ static bool srcu_readers_active_idx_check(struct srcu_struct *sp, int idx) · 29 unmodified lines
329329 * of floor(ULONG_MAX/NR_CPUS/2), which should be sufficient,
330330 * especially on 64-bit systems.
331331 */
332− return srcu_readers_lock_idx(sp, idx) == unlocks;
332+ return srcu_readers_lock_idx(ssp, idx) == unlocks;
333333 }
334334
335335 /**
336336 * srcu_readers_active - returns true if there are readers. and false
337337 * otherwise
338− * @sp: which srcu_struct to count active readers (holding srcu_read_lock).
338+ * @ssp: which srcu_struct to count active readers (holding srcu_read_lock).
339339 *
340340 * Note that this is not an atomic primitive, and can therefore suffer
341341 * severe errors when invoked on an active srcu_struct. That said, it
342342 * can be useful as an error check at cleanup time.
343343 */
344−static bool srcu_readers_active(struct srcu_struct *sp)
344+static bool srcu_readers_active(struct srcu_struct *ssp)
345345 {
346346 int cpu;
347347 unsigned long sum = 0;
348348
349349 for_each_possible_cpu(cpu) {
350− struct srcu_data *cpuc = per_cpu_ptr(sp->sda, cpu);
350+ struct srcu_data *cpuc = per_cpu_ptr(ssp->sda, cpu);
351351
352352 sum += READ_ONCE(cpuc->srcu_lock_count[0]);
353353 sum += READ_ONCE(cpuc->srcu_lock_count[1]);
@@ -363,44 +363,44 @@ static bool srcu_readers_active(struct srcu_struct *sp) · 9 unmodified lines
363363 * Return grace-period delay, zero if there are expedited grace
364364 * periods pending, SRCU_INTERVAL otherwise.
365365 */
366−static unsigned long srcu_get_delay(struct srcu_struct *sp)
366+static unsigned long srcu_get_delay(struct srcu_struct *ssp)
367367 {
368− if (ULONG_CMP_LT(READ_ONCE(sp->srcu_gp_seq),
369− READ_ONCE(sp->srcu_gp_seq_needed_exp)))
368+ if (ULONG_CMP_LT(READ_ONCE(ssp->srcu_gp_seq),
369+ READ_ONCE(ssp->srcu_gp_seq_needed_exp)))
370370 return 0;
371371 return SRCU_INTERVAL;
372372 }
373373
374374 /* Helper for cleanup_srcu_struct() and cleanup_srcu_struct_quiesced(). */
375−void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced)
375+void _cleanup_srcu_struct(struct srcu_struct *ssp, bool quiesced)
376376 {
377377 int cpu;
378378
379− if (WARN_ON(!srcu_get_delay(sp)))
379+ if (WARN_ON(!srcu_get_delay(ssp)))
380380 return; /* Just leak it! */
381− if (WARN_ON(srcu_readers_active(sp)))
381+ if (WARN_ON(srcu_readers_active(ssp)))
382382 return; /* Just leak it! */
383383 if (quiesced) {
384− if (WARN_ON(delayed_work_pending(&sp->work)))
384+ if (WARN_ON(delayed_work_pending(&ssp->work)))
385385 return; /* Just leak it! */
386386 } else {
387− flush_delayed_work(&sp->work);
387+ flush_delayed_work(&ssp->work);
388388 }
389389 for_each_possible_cpu(cpu)
390390 if (quiesced) {
391− if (WARN_ON(delayed_work_pending(&per_cpu_ptr(sp->sda, cpu)->work)))
391+ if (WARN_ON(delayed_work_pending(&per_cpu_ptr(ssp->sda, cpu)->work)))
392392 return; /* Just leak it! */
393393 } else {
394− flush_delayed_work(&per_cpu_ptr(sp->sda, cpu)->work);
394+ flush_delayed_work(&per_cpu_ptr(ssp->sda, cpu)->work);
395395 }
396− if (WARN_ON(rcu_seq_state(READ_ONCE(sp->srcu_gp_seq)) != SRCU_STATE_IDLE) ||
397− WARN_ON(srcu_readers_active(sp))) {
396+ if (WARN_ON(rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq)) != SRCU_STATE_IDLE) ||
397+ WARN_ON(srcu_readers_active(ssp))) {
398398 pr_info("%s: Active srcu_struct %p state: %d\n",
399− __func__, sp, rcu_seq_state(READ_ONCE(sp->srcu_gp_seq)));
399+ __func__, ssp, rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq)));
400400 return; /* Caller forgot to stop doing call_srcu()? */
401401 }
402− free_percpu(sp->sda);
403− sp->sda = NULL;
402+ free_percpu(ssp->sda);
403+ ssp->sda = NULL;
404404 }
405405 EXPORT_SYMBOL_GPL(_cleanup_srcu_struct);
406406
@@ -409,12 +409,12 @@ EXPORT_SYMBOL_GPL(_cleanup_srcu_struct); · 2 unmodified lines
409409 * srcu_struct.
410410 * Returns an index that must be passed to the matching srcu_read_unlock().
411411 */
412−int __srcu_read_lock(struct srcu_struct *sp)
412+int __srcu_read_lock(struct srcu_struct *ssp)
413413 {
414414 int idx;
415415
416− idx = READ_ONCE(sp->srcu_idx) & 0x1;
417− this_cpu_inc(sp->sda->srcu_lock_count[idx]);
416+ idx = READ_ONCE(ssp->srcu_idx) & 0x1;
417+ this_cpu_inc(ssp->sda->srcu_lock_count[idx]);
418418 smp_mb(); /* B */ /* Avoid leaking the critical section. */
419419 return idx;
420420 }
@@ -425,10 +425,10 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 4 unmodified lines
425425 * element of the srcu_struct. Note that this may well be a different
426426 * CPU than that which was incremented by the corresponding srcu_read_lock().
427427 */
428−void __srcu_read_unlock(struct srcu_struct *sp, int idx)
428+void __srcu_read_unlock(struct srcu_struct *ssp, int idx)
429429 {
430430 smp_mb(); /* C */ /* Avoid leaking the critical section. */
431− this_cpu_inc(sp->sda->srcu_unlock_count[idx]);
431+ this_cpu_inc(ssp->sda->srcu_unlock_count[idx]);
432432 }
433433 EXPORT_SYMBOL_GPL(__srcu_read_unlock);
434434
@@ -444,22 +444,22 @@ EXPORT_SYMBOL_GPL(__srcu_read_unlock); · 9 unmodified lines
444444 /*
445445 * Start an SRCU grace period.
446446 */
447−static void srcu_gp_start(struct srcu_struct *sp)
447+static void srcu_gp_start(struct srcu_struct *ssp)
448448 {
449− struct srcu_data *sdp = this_cpu_ptr(sp->sda);
449+ struct srcu_data *sdp = this_cpu_ptr(ssp->sda);
450450 int state;
451451
452− lockdep_assert_held(&ACCESS_PRIVATE(sp, lock));
453− WARN_ON_ONCE(ULONG_CMP_GE(sp->srcu_gp_seq, sp->srcu_gp_seq_needed));
452+ lockdep_assert_held(&ACCESS_PRIVATE(ssp, lock));
453+ WARN_ON_ONCE(ULONG_CMP_GE(ssp->srcu_gp_seq, ssp->srcu_gp_seq_needed));
454454 spin_lock_rcu_node(sdp); /* Interrupts already disabled. */
455455 rcu_segcblist_advance(&sdp->srcu_cblist,
456− rcu_seq_current(&sp->srcu_gp_seq));
456+ rcu_seq_current(&ssp->srcu_gp_seq));
457457 (void)rcu_segcblist_accelerate(&sdp->srcu_cblist,
458− rcu_seq_snap(&sp->srcu_gp_seq));
458+ rcu_seq_snap(&ssp->srcu_gp_seq));
459459 spin_unlock_rcu_node(sdp); /* Interrupts remain disabled. */
460460 smp_mb(); /* Order prior store to ->srcu_gp_seq_needed vs. GP start. */
461− rcu_seq_start(&sp->srcu_gp_seq);
462− state = rcu_seq_state(READ_ONCE(sp->srcu_gp_seq));
461+ rcu_seq_start(&ssp->srcu_gp_seq);
462+ state = rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq));
463463 WARN_ON_ONCE(state != SRCU_STATE_SCAN1);
464464 }
465465
@@ -513,7 +513,7 @@ static void srcu_schedule_cbs_sdp(struct srcu_data *sdp, unsigned long delay) · 47 unmodified lines
513513 * just-completed grace period, the one corresponding to idx. If possible,
514514 * schedule this invocation on the corresponding CPUs.
515515 */
516−static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp,
516+static void srcu_schedule_cbs_snp(struct srcu_struct *ssp, struct srcu_node *snp,
517517 unsigned long mask, unsigned long delay)
518518 {
519519 int cpu;
@@ -521,7 +521,7 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp, · 1 unmodified line
521521 for (cpu = snp->grplo; cpu <= snp->grphi; cpu++) {
522522 if (!(mask & (1 << (cpu - snp->grplo))))
523523 continue;
524− srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu), delay);
524+ srcu_schedule_cbs_sdp(per_cpu_ptr(ssp->sda, cpu), delay);
525525 }
526526 }
527527
@@ -534,7 +534,7 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp, · 6 unmodified lines
534534 * are initiating callback invocation. This allows the ->srcu_have_cbs[]
535535 * array to have a finite number of elements.
536536 */
537−static void srcu_gp_end(struct srcu_struct *sp)
537+static void srcu_gp_end(struct srcu_struct *ssp)
538538 {
539539 unsigned long cbdelay;
540540 bool cbs;
@@ -548,28 +548,28 @@ static void srcu_gp_end(struct srcu_struct *sp) · 7 unmodified lines
548548 struct srcu_node *snp;
549549
550550 /* Prevent more than one additional grace period. */
551− mutex_lock(&sp->srcu_cb_mutex);
551+ mutex_lock(&ssp->srcu_cb_mutex);
552552
553553 /* End the current grace period. */
554− spin_lock_irq_rcu_node(sp);
555− idx = rcu_seq_state(sp->srcu_gp_seq);
554+ spin_lock_irq_rcu_node(ssp);
555+ idx = rcu_seq_state(ssp->srcu_gp_seq);
556556 WARN_ON_ONCE(idx != SRCU_STATE_SCAN2);
557− cbdelay = srcu_get_delay(sp);
558− sp->srcu_last_gp_end = ktime_get_mono_fast_ns();
559− rcu_seq_end(&sp->srcu_gp_seq);
560− gpseq = rcu_seq_current(&sp->srcu_gp_seq);
561− if (ULONG_CMP_LT(sp->srcu_gp_seq_needed_exp, gpseq))
562− sp->srcu_gp_seq_needed_exp = gpseq;
563− spin_unlock_irq_rcu_node(sp);
564− mutex_unlock(&sp->srcu_gp_mutex);
557+ cbdelay = srcu_get_delay(ssp);
558+ ssp->srcu_last_gp_end = ktime_get_mono_fast_ns();
559+ rcu_seq_end(&ssp->srcu_gp_seq);
560+ gpseq = rcu_seq_current(&ssp->srcu_gp_seq);
561+ if (ULONG_CMP_LT(ssp->srcu_gp_seq_needed_exp, gpseq))
562+ ssp->srcu_gp_seq_needed_exp = gpseq;
563+ spin_unlock_irq_rcu_node(ssp);
564+ mutex_unlock(&ssp->srcu_gp_mutex);
565565 /* A new grace period can start at this point. But only one. */
566566
567567 /* Initiate callback invocation as needed. */
568568 idx = rcu_seq_ctr(gpseq) % ARRAY_SIZE(snp->srcu_have_cbs);
569− srcu_for_each_node_breadth_first(sp, snp) {
569+ srcu_for_each_node_breadth_first(ssp, snp) {
570570 spin_lock_irq_rcu_node(snp);
571571 cbs = false;
572− last_lvl = snp >= sp->level[rcu_num_lvls - 1];
572+ last_lvl = snp >= ssp->level[rcu_num_lvls - 1];
573573 if (last_lvl)
574574 cbs = snp->srcu_have_cbs[idx] == gpseq;
575575 snp->srcu_have_cbs[idx] = gpseq;
@@ -580,12 +580,12 @@ static void srcu_gp_end(struct srcu_struct *sp) · 4 unmodified lines
580580 snp->srcu_data_have_cbs[idx] = 0;
581581 spin_unlock_irq_rcu_node(snp);
582582 if (cbs)
583− srcu_schedule_cbs_snp(sp, snp, mask, cbdelay);
583+ srcu_schedule_cbs_snp(ssp, snp, mask, cbdelay);
584584
585585 /* Occasionally prevent srcu_data counter wrap. */
586586 if (!(gpseq & counter_wrap_check) && last_lvl)
587587 for (cpu = snp->grplo; cpu <= snp->grphi; cpu++) {
588− sdp = per_cpu_ptr(sp->sda, cpu);
588+ sdp = per_cpu_ptr(ssp->sda, cpu);
589589 spin_lock_irqsave_rcu_node(sdp, flags);
590590 if (ULONG_CMP_GE(gpseq,
591591 sdp->srcu_gp_seq_needed + 100))
@@ -598,18 +598,18 @@ static void srcu_gp_end(struct srcu_struct *sp) · 6 unmodified lines
598598 }
599599
600600 /* Callback initiation done, allow grace periods after next. */
601− mutex_unlock(&sp->srcu_cb_mutex);
601+ mutex_unlock(&ssp->srcu_cb_mutex);
602602
603603 /* Start a new grace period if needed. */
604− spin_lock_irq_rcu_node(sp);
605− gpseq = rcu_seq_current(&sp->srcu_gp_seq);
604+ spin_lock_irq_rcu_node(ssp);
605+ gpseq = rcu_seq_current(&ssp->srcu_gp_seq);
606606 if (!rcu_seq_state(gpseq) &&
607− ULONG_CMP_LT(gpseq, sp->srcu_gp_seq_needed)) {
608− srcu_gp_start(sp);
609− spin_unlock_irq_rcu_node(sp);
610− srcu_reschedule(sp, 0);
607+ ULONG_CMP_LT(gpseq, ssp->srcu_gp_seq_needed)) {
608+ srcu_gp_start(ssp);
609+ spin_unlock_irq_rcu_node(ssp);
610+ srcu_reschedule(ssp, 0);
611611 } else {
612− spin_unlock_irq_rcu_node(sp);
612+ spin_unlock_irq_rcu_node(ssp);
613613 }
614614 }
615615
@@ -620,13 +620,13 @@ static void srcu_gp_end(struct srcu_struct *sp) · 4 unmodified lines
620620 * but without expediting. To start a completely new grace period,
621621 * whether expedited or not, use srcu_funnel_gp_start() instead.
622622 */
623−static void srcu_funnel_exp_start(struct srcu_struct *sp, struct srcu_node *snp,
623+static void srcu_funnel_exp_start(struct srcu_struct *ssp, struct srcu_node *snp,
624624 unsigned long s)
625625 {
626626 unsigned long flags;
627627
628628 for (; snp != NULL; snp = snp->srcu_parent) {
629− if (rcu_seq_done(&sp->srcu_gp_seq, s) ||
629+ if (rcu_seq_done(&ssp->srcu_gp_seq, s) ||
630630 ULONG_CMP_GE(READ_ONCE(snp->srcu_gp_seq_needed_exp), s))
631631 return;
632632 spin_lock_irqsave_rcu_node(snp, flags);
@@ -637,10 +637,10 @@ static void srcu_funnel_exp_start(struct srcu_struct *sp, struct srcu_node *snp, · 4 unmodified lines
637637 WRITE_ONCE(snp->srcu_gp_seq_needed_exp, s);
638638 spin_unlock_irqrestore_rcu_node(snp, flags);
639639 }
640− spin_lock_irqsave_rcu_node(sp, flags);
641− if (ULONG_CMP_LT(sp->srcu_gp_seq_needed_exp, s))
642− sp->srcu_gp_seq_needed_exp = s;
643− spin_unlock_irqrestore_rcu_node(sp, flags);
640+ spin_lock_irqsave_rcu_node(ssp, flags);
641+ if (ULONG_CMP_LT(ssp->srcu_gp_seq_needed_exp, s))
642+ ssp->srcu_gp_seq_needed_exp = s;
643+ spin_unlock_irqrestore_rcu_node(ssp, flags);
644644 }
645645
646646 /*
@@ -653,7 +653,7 @@ static void srcu_funnel_exp_start(struct srcu_struct *sp, struct srcu_node *snp, · 6 unmodified lines
653653 * Note that this function also does the work of srcu_funnel_exp_start(),
654654 * in some cases by directly invoking it.
655655 */
656−static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp,
656+static void srcu_funnel_gp_start(struct srcu_struct *ssp, struct srcu_data *sdp,
657657 unsigned long s, bool do_norm)
658658 {
659659 unsigned long flags;
@@ -663,7 +663,7 @@ static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp, · 3 unmodified lines
663663
664664 /* Each pass through the loop does one level of the srcu_node tree. */
665665 for (; snp != NULL; snp = snp->srcu_parent) {
666− if (rcu_seq_done(&sp->srcu_gp_seq, s) && snp != sdp->mynode)
666+ if (rcu_seq_done(&ssp->srcu_gp_seq, s) && snp != sdp->mynode)
667667 return; /* GP already done and CBs recorded. */
668668 spin_lock_irqsave_rcu_node(snp, flags);
669669 if (ULONG_CMP_GE(snp->srcu_have_cbs[idx], s)) {
@@ -678,7 +678,7 @@ static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp, · 8 unmodified lines
678678 return;
679679 }
680680 if (!do_norm)
681− srcu_funnel_exp_start(sp, snp, s);
681+ srcu_funnel_exp_start(ssp, snp, s);
682682 return;
683683 }
684684 snp->srcu_have_cbs[idx] = s;
@@ -690,29 +690,29 @@ static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp, · 5 unmodified lines
690690 }
691691
692692 /* Top of tree, must ensure the grace period will be started. */
693− spin_lock_irqsave_rcu_node(sp, flags);
694− if (ULONG_CMP_LT(sp->srcu_gp_seq_needed, s)) {
693+ spin_lock_irqsave_rcu_node(ssp, flags);
694+ if (ULONG_CMP_LT(ssp->srcu_gp_seq_needed, s)) {
695695 /*
696696 * Record need for grace period s. Pair with load
697697 * acquire setting up for initialization.
698698 */
699− smp_store_release(&sp->srcu_gp_seq_needed, s); /*^^^*/
699+ smp_store_release(&ssp->srcu_gp_seq_needed, s); /*^^^*/
700700 }
701− if (!do_norm && ULONG_CMP_LT(sp->srcu_gp_seq_needed_exp, s))
702− sp->srcu_gp_seq_needed_exp = s;
701+ if (!do_norm && ULONG_CMP_LT(ssp->srcu_gp_seq_needed_exp, s))
702+ ssp->srcu_gp_seq_needed_exp = s;
703703
704704 /* If grace period not already done and none in progress, start it. */
705− if (!rcu_seq_done(&sp->srcu_gp_seq, s) &&
706− rcu_seq_state(sp->srcu_gp_seq) == SRCU_STATE_IDLE) {
707− WARN_ON_ONCE(ULONG_CMP_GE(sp->srcu_gp_seq, sp->srcu_gp_seq_needed));
708− srcu_gp_start(sp);
705+ if (!rcu_seq_done(&ssp->srcu_gp_seq, s) &&
706+ rcu_seq_state(ssp->srcu_gp_seq) == SRCU_STATE_IDLE) {
707+ WARN_ON_ONCE(ULONG_CMP_GE(ssp->srcu_gp_seq, ssp->srcu_gp_seq_needed));
708+ srcu_gp_start(ssp);
709709 if (likely(srcu_init_done))
710− queue_delayed_work(rcu_gp_wq, &sp->work,
711− srcu_get_delay(sp));
712− else if (list_empty(&sp->work.work.entry))
713− list_add(&sp->work.work.entry, &srcu_boot_list);
710+ queue_delayed_work(rcu_gp_wq, &ssp->work,
711+ srcu_get_delay(ssp));
712+ else if (list_empty(&ssp->work.work.entry))
713+ list_add(&ssp->work.work.entry, &srcu_boot_list);
714714 }
715− spin_unlock_irqrestore_rcu_node(sp, flags);
715+ spin_unlock_irqrestore_rcu_node(ssp, flags);
716716 }
717717
718718 /*
@@ -720,12 +720,12 @@ static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp, · 1 unmodified line
720720 * loop an additional time if there is an expedited grace period pending.
721721 * The caller must ensure that ->srcu_idx is not changed while checking.
722722 */
723−static bool try_check_zero(struct srcu_struct *sp, int idx, int trycount)
723+static bool try_check_zero(struct srcu_struct *ssp, int idx, int trycount)
724724 {
725725 for (;;) {
726− if (srcu_readers_active_idx_check(sp, idx))
726+ if (srcu_readers_active_idx_check(ssp, idx))
727727 return true;
728− if (--trycount + !srcu_get_delay(sp) <= 0)
728+ if (--trycount + !srcu_get_delay(ssp) <= 0)
729729 return false;
730730 udelay(SRCU_RETRY_CHECK_DELAY);
731731 }
@@ -736,7 +736,7 @@ static bool try_check_zero(struct srcu_struct *sp, int idx, int trycount) · 4 unmodified lines
736736 * use the other rank of the ->srcu_(un)lock_count[] arrays. This allows
737737 * us to wait for pre-existing readers in a starvation-free manner.
738738 */
739−static void srcu_flip(struct srcu_struct *sp)
739+static void srcu_flip(struct srcu_struct *ssp)
740740 {
741741 /*
742742 * Ensure that if this updater saw a given reader's increment
@@ -748,7 +748,7 @@ static void srcu_flip(struct srcu_struct *sp) · 5 unmodified lines
748748 */
749749 smp_mb(); /* E */ /* Pairs with B and C. */
750750
751− WRITE_ONCE(sp->srcu_idx, sp->srcu_idx + 1);
751+ WRITE_ONCE(ssp->srcu_idx, ssp->srcu_idx + 1);
752752
753753 /*
754754 * Ensure that if the updater misses an __srcu_read_unlock()
@@ -781,7 +781,7 @@ static void srcu_flip(struct srcu_struct *sp) · 26 unmodified lines
781781 * negligible when amoritized over that time period, and the extra latency
782782 * of a needlessly non-expedited grace period is similarly negligible.
783783 */
784−static bool srcu_might_be_idle(struct srcu_struct *sp)
784+static bool srcu_might_be_idle(struct srcu_struct *ssp)
785785 {
786786 unsigned long curseq;
787787 unsigned long flags;
@@ -790,7 +790,7 @@ static bool srcu_might_be_idle(struct srcu_struct *sp) · 2 unmodified lines
790790
791791 /* If the local srcu_data structure has callbacks, not idle. */
792792 local_irq_save(flags);
793− sdp = this_cpu_ptr(sp->sda);
793+ sdp = this_cpu_ptr(ssp->sda);
794794 if (rcu_segcblist_pend_cbs(&sdp->srcu_cblist)) {
795795 local_irq_restore(flags);
796796 return false; /* Callbacks already present, so not idle. */
@@ -806,17 +806,17 @@ static bool srcu_might_be_idle(struct srcu_struct *sp) · 9 unmodified lines
806806 /* First, see if enough time has passed since the last GP. */
807807 t = ktime_get_mono_fast_ns();
808808 if (exp_holdoff == 0 ||
809− time_in_range_open(t, sp->srcu_last_gp_end,
810− sp->srcu_last_gp_end + exp_holdoff))
809+ time_in_range_open(t, ssp->srcu_last_gp_end,
810+ ssp->srcu_last_gp_end + exp_holdoff))
811811 return false; /* Too soon after last GP. */
812812
813813 /* Next, check for probable idleness. */
814− curseq = rcu_seq_current(&sp->srcu_gp_seq);
814+ curseq = rcu_seq_current(&ssp->srcu_gp_seq);
815815 smp_mb(); /* Order ->srcu_gp_seq with ->srcu_gp_seq_needed. */
816− if (ULONG_CMP_LT(curseq, READ_ONCE(sp->srcu_gp_seq_needed)))
816+ if (ULONG_CMP_LT(curseq, READ_ONCE(ssp->srcu_gp_seq_needed)))
817817 return false; /* Grace period in progress, so not idle. */
818818 smp_mb(); /* Order ->srcu_gp_seq with prior access. */
819− if (curseq != rcu_seq_current(&sp->srcu_gp_seq))
819+ if (curseq != rcu_seq_current(&ssp->srcu_gp_seq))
820820 return false; /* GP # changed, so not idle. */
821821 return true; /* With reasonable probability, idle! */
822822 }
@@ -856,7 +856,7 @@ static void srcu_leak_callback(struct rcu_head *rhp) · 33 unmodified lines
856856 * srcu_read_lock(), and srcu_read_unlock() that are all passed the same
857857 * srcu_struct structure.
858858 */
859−void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp,
859+void __call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
860860 rcu_callback_t func, bool do_norm)
861861 {
862862 unsigned long flags;
@@ -866,7 +866,7 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp, · 3 unmodified lines
866866 unsigned long s;
867867 struct srcu_data *sdp;
868868
869− check_init_srcu_struct(sp);
869+ check_init_srcu_struct(ssp);
870870 if (debug_rcu_head_queue(rhp)) {
871871 /* Probable double call_srcu(), so leak the callback. */
872872 WRITE_ONCE(rhp->func, srcu_leak_callback);
@@ -874,14 +874,14 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp, · 1 unmodified line
874874 return;
875875 }
876876 rhp->func = func;
877− idx = srcu_read_lock(sp);
877+ idx = srcu_read_lock(ssp);
878878 local_irq_save(flags);
879− sdp = this_cpu_ptr(sp->sda);
879+ sdp = this_cpu_ptr(ssp->sda);
880880 spin_lock_rcu_node(sdp);
881881 rcu_segcblist_enqueue(&sdp->srcu_cblist, rhp, false);
882882 rcu_segcblist_advance(&sdp->srcu_cblist,
883− rcu_seq_current(&sp->srcu_gp_seq));
884− s = rcu_seq_snap(&sp->srcu_gp_seq);
883+ rcu_seq_current(&ssp->srcu_gp_seq));
884+ s = rcu_seq_snap(&ssp->srcu_gp_seq);
885885 (void)rcu_segcblist_accelerate(&sdp->srcu_cblist, s);
886886 if (ULONG_CMP_LT(sdp->srcu_gp_seq_needed, s)) {
887887 sdp->srcu_gp_seq_needed = s;
@@ -893,15 +893,15 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp, · 5 unmodified lines
893893 }
894894 spin_unlock_irqrestore_rcu_node(sdp, flags);
895895 if (needgp)
896− srcu_funnel_gp_start(sp, sdp, s, do_norm);
896+ srcu_funnel_gp_start(ssp, sdp, s, do_norm);
897897 else if (needexp)
898− srcu_funnel_exp_start(sp, sdp->mynode, s);
899− srcu_read_unlock(sp, idx);
898+ srcu_funnel_exp_start(ssp, sdp->mynode, s);
899+ srcu_read_unlock(ssp, idx);
900900 }
901901
902902 /**
903903 * call_srcu() - Queue a callback for invocation after an SRCU grace period
904− * @sp: srcu_struct in queue the callback
904+ * @ssp: srcu_struct in queue the callback
905905 * @rhp: structure to be used for queueing the SRCU callback.
906906 * @func: function to be invoked after the SRCU grace period
907907 *
@@ -916,21 +916,21 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp, · 8 unmodified lines
916916 * The callback will be invoked from process context, but must nevertheless
917917 * be fast and must not block.
918918 */
919−void call_srcu(struct srcu_struct *sp, struct rcu_head *rhp,
919+void call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
920920 rcu_callback_t func)
921921 {
922− __call_srcu(sp, rhp, func, true);
922+ __call_srcu(ssp, rhp, func, true);
923923 }
924924 EXPORT_SYMBOL_GPL(call_srcu);
925925
926926 /*
927927 * Helper function for synchronize_srcu() and synchronize_srcu_expedited().
928928 */
929−static void __synchronize_srcu(struct srcu_struct *sp, bool do_norm)
929+static void __synchronize_srcu(struct srcu_struct *ssp, bool do_norm)
930930 {
931931 struct rcu_synchronize rcu;
932932
933− RCU_LOCKDEP_WARN(lock_is_held(&sp->dep_map) ||
933+ RCU_LOCKDEP_WARN(lock_is_held(&ssp->dep_map) ||
934934 lock_is_held(&rcu_bh_lock_map) ||
935935 lock_is_held(&rcu_lock_map) ||
936936 lock_is_held(&rcu_sched_lock_map),
@@ -939,10 +939,10 @@ static void __synchronize_srcu(struct srcu_struct *sp, bool do_norm) · 2 unmodified lines
939939 if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
940940 return;
941941 might_sleep();
942− check_init_srcu_struct(sp);
942+ check_init_srcu_struct(ssp);
943943 init_completion(&rcu.completion);
944944 init_rcu_head_on_stack(&rcu.head);
945− __call_srcu(sp, &rcu.head, wakeme_after_rcu, do_norm);
945+ __call_srcu(ssp, &rcu.head, wakeme_after_rcu, do_norm);
946946 wait_for_completion(&rcu.completion);
947947 destroy_rcu_head_on_stack(&rcu.head);
948948
@@ -958,7 +958,7 @@ static void __synchronize_srcu(struct srcu_struct *sp, bool do_norm) · 9 unmodified lines
958958
959959 /**
960960 * synchronize_srcu_expedited - Brute-force SRCU grace period
961− * @sp: srcu_struct with which to synchronize.
961+ * @ssp: srcu_struct with which to synchronize.
962962 *
963963 * Wait for an SRCU grace period to elapse, but be more aggressive about
964964 * spinning rather than blocking when waiting.
@@ -966,15 +966,15 @@ static void __synchronize_srcu(struct srcu_struct *sp, bool do_norm) · 1 unmodified line
966966 * Note that synchronize_srcu_expedited() has the same deadlock and
967967 * memory-ordering properties as does synchronize_srcu().
968968 */
969−void synchronize_srcu_expedited(struct srcu_struct *sp)
969+void synchronize_srcu_expedited(struct srcu_struct *ssp)
970970 {
971− __synchronize_srcu(sp, rcu_gp_is_normal());
971+ __synchronize_srcu(ssp, rcu_gp_is_normal());
972972 }
973973 EXPORT_SYMBOL_GPL(synchronize_srcu_expedited);
974974
975975 /**
976976 * synchronize_srcu - wait for prior SRCU read-side critical-section completion
977− * @sp: srcu_struct with which to synchronize.
977+ * @ssp: srcu_struct with which to synchronize.
978978 *
979979 * Wait for the count to drain to zero of both indexes. To avoid the
980980 * possible starvation of synchronize_srcu(), it waits for the count of
@@ -1016,12 +1016,12 @@ EXPORT_SYMBOL_GPL(synchronize_srcu_expedited); · 35 unmodified lines
10161016 * SRCU must also provide it. Note that detecting idleness is heuristic
10171017 * and subject to both false positives and negatives.
10181018 */
1019−void synchronize_srcu(struct srcu_struct *sp)
1019+void synchronize_srcu(struct srcu_struct *ssp)
10201020 {
1021− if (srcu_might_be_idle(sp) || rcu_gp_is_expedited())
1022− synchronize_srcu_expedited(sp);
1021+ if (srcu_might_be_idle(ssp) || rcu_gp_is_expedited())
1022+ synchronize_srcu_expedited(ssp);
10231023 else
1024− __synchronize_srcu(sp, true);
1024+ __synchronize_srcu(ssp, true);
10251025 }
10261026 EXPORT_SYMBOL_GPL(synchronize_srcu);
10271027
@@ -1031,36 +1031,36 @@ EXPORT_SYMBOL_GPL(synchronize_srcu); · 3 unmodified lines
10311031 static void srcu_barrier_cb(struct rcu_head *rhp)
10321032 {
10331033 struct srcu_data *sdp;
1034− struct srcu_struct *sp;
1034+ struct srcu_struct *ssp;
10351035
10361036 sdp = container_of(rhp, struct srcu_data, srcu_barrier_head);
1037− sp = sdp->sp;
1038− if (atomic_dec_and_test(&sp->srcu_barrier_cpu_cnt))
1039− complete(&sp->srcu_barrier_completion);
1037+ ssp = sdp->ssp;
1038+ if (atomic_dec_and_test(&ssp->srcu_barrier_cpu_cnt))
1039+ complete(&ssp->srcu_barrier_completion);
10401040 }
10411041
10421042 /**
10431043 * srcu_barrier - Wait until all in-flight call_srcu() callbacks complete.
1044− * @sp: srcu_struct on which to wait for in-flight callbacks.
1044+ * @ssp: srcu_struct on which to wait for in-flight callbacks.
10451045 */
1046−void srcu_barrier(struct srcu_struct *sp)
1046+void srcu_barrier(struct srcu_struct *ssp)
10471047 {
10481048 int cpu;
10491049 struct srcu_data *sdp;
1050− unsigned long s = rcu_seq_snap(&sp->srcu_barrier_seq);
1050+ unsigned long s = rcu_seq_snap(&ssp->srcu_barrier_seq);
10511051
1052− check_init_srcu_struct(sp);
1053− mutex_lock(&sp->srcu_barrier_mutex);
1054− if (rcu_seq_done(&sp->srcu_barrier_seq, s)) {
1052+ check_init_srcu_struct(ssp);
1053+ mutex_lock(&ssp->srcu_barrier_mutex);
1054+ if (rcu_seq_done(&ssp->srcu_barrier_seq, s)) {
10551055 smp_mb(); /* Force ordering following return. */
1056− mutex_unlock(&sp->srcu_barrier_mutex);
1056+ mutex_unlock(&ssp->srcu_barrier_mutex);
10571057 return; /* Someone else did our work for us. */
10581058 }
1059− rcu_seq_start(&sp->srcu_barrier_seq);
1060− init_completion(&sp->srcu_barrier_completion);
1059+ rcu_seq_start(&ssp->srcu_barrier_seq);
1060+ init_completion(&ssp->srcu_barrier_completion);
10611061
10621062 /* Initial count prevents reaching zero until all CBs are posted. */
1063− atomic_set(&sp->srcu_barrier_cpu_cnt, 1);
1063+ atomic_set(&ssp->srcu_barrier_cpu_cnt, 1);
10641064
10651065 /*
10661066 * Each pass through this loop enqueues a callback, but only
@@ -1071,39 +1071,39 @@ void srcu_barrier(struct srcu_struct *sp) · 4 unmodified lines
10711071 * grace period as the last callback already in the queue.
10721072 */
10731073 for_each_possible_cpu(cpu) {
1074− sdp = per_cpu_ptr(sp->sda, cpu);
1074+ sdp = per_cpu_ptr(ssp->sda, cpu);
10751075 spin_lock_irq_rcu_node(sdp);
1076− atomic_inc(&sp->srcu_barrier_cpu_cnt);
1076+ atomic_inc(&ssp->srcu_barrier_cpu_cnt);
10771077 sdp->srcu_barrier_head.func = srcu_barrier_cb;
10781078 debug_rcu_head_queue(&sdp->srcu_barrier_head);
10791079 if (!rcu_segcblist_entrain(&sdp->srcu_cblist,
10801080 &sdp->srcu_barrier_head, 0)) {
10811081 debug_rcu_head_unqueue(&sdp->srcu_barrier_head);
1082− atomic_dec(&sp->srcu_barrier_cpu_cnt);
1082+ atomic_dec(&ssp->srcu_barrier_cpu_cnt);
10831083 }
10841084 spin_unlock_irq_rcu_node(sdp);
10851085 }
10861086
10871087 /* Remove the initial count, at which point reaching zero can happen. */
1088− if (atomic_dec_and_test(&sp->srcu_barrier_cpu_cnt))
1089− complete(&sp->srcu_barrier_completion);
1090− wait_for_completion(&sp->srcu_barrier_completion);
1088+ if (atomic_dec_and_test(&ssp->srcu_barrier_cpu_cnt))
1089+ complete(&ssp->srcu_barrier_completion);
1090+ wait_for_completion(&ssp->srcu_barrier_completion);
10911091
1092− rcu_seq_end(&sp->srcu_barrier_seq);
1093− mutex_unlock(&sp->srcu_barrier_mutex);
1092+ rcu_seq_end(&ssp->srcu_barrier_seq);
1093+ mutex_unlock(&ssp->srcu_barrier_mutex);
10941094 }
10951095 EXPORT_SYMBOL_GPL(srcu_barrier);
10961096
10971097 /**
10981098 * srcu_batches_completed - return batches completed.
1099− * @sp: srcu_struct on which to report batch completion.
1099+ * @ssp: srcu_struct on which to report batch completion.
11001100 *
11011101 * Report the number of batches, correlated with, but not necessarily
11021102 * precisely the same as, the number of grace periods that have elapsed.
11031103 */
1104−unsigned long srcu_batches_completed(struct srcu_struct *sp)
1104+unsigned long srcu_batches_completed(struct srcu_struct *ssp)
11051105 {
1106− return sp->srcu_idx;
1106+ return ssp->srcu_idx;
11071107 }
11081108 EXPORT_SYMBOL_GPL(srcu_batches_completed);
11091109
@@ -1112,11 +1112,11 @@ EXPORT_SYMBOL_GPL(srcu_batches_completed); · 2 unmodified lines
11121112 * to SRCU_STATE_SCAN2, and invoke srcu_gp_end() when scan has
11131113 * completed in that state.
11141114 */
1115−static void srcu_advance_state(struct srcu_struct *sp)
1115+static void srcu_advance_state(struct srcu_struct *ssp)
11161116 {
11171117 int idx;
11181118
1119− mutex_lock(&sp->srcu_gp_mutex);
1119+ mutex_lock(&ssp->srcu_gp_mutex);
11201120
11211121 /*
11221122 * Because readers might be delayed for an extended period after
@@ -1128,47 +1128,47 @@ static void srcu_advance_state(struct srcu_struct *sp) · 5 unmodified lines
11281128 * The load-acquire ensures that we see the accesses performed
11291129 * by the prior grace period.
11301130 */
1131− idx = rcu_seq_state(smp_load_acquire(&sp->srcu_gp_seq)); /* ^^^ */
1131+ idx = rcu_seq_state(smp_load_acquire(&ssp->srcu_gp_seq)); /* ^^^ */
11321132 if (idx == SRCU_STATE_IDLE) {
1133− spin_lock_irq_rcu_node(sp);
1134− if (ULONG_CMP_GE(sp->srcu_gp_seq, sp->srcu_gp_seq_needed)) {
1135− WARN_ON_ONCE(rcu_seq_state(sp->srcu_gp_seq));
1136− spin_unlock_irq_rcu_node(sp);
1137− mutex_unlock(&sp->srcu_gp_mutex);
1133+ spin_lock_irq_rcu_node(ssp);
1134+ if (ULONG_CMP_GE(ssp->srcu_gp_seq, ssp->srcu_gp_seq_needed)) {
1135+ WARN_ON_ONCE(rcu_seq_state(ssp->srcu_gp_seq));
1136+ spin_unlock_irq_rcu_node(ssp);
1137+ mutex_unlock(&ssp->srcu_gp_mutex);
11381138 return;
11391139 }
1140− idx = rcu_seq_state(READ_ONCE(sp->srcu_gp_seq));
1140+ idx = rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq));
11411141 if (idx == SRCU_STATE_IDLE)
1142− srcu_gp_start(sp);
1143− spin_unlock_irq_rcu_node(sp);
1142+ srcu_gp_start(ssp);
1143+ spin_unlock_irq_rcu_node(ssp);
11441144 if (idx != SRCU_STATE_IDLE) {
1145− mutex_unlock(&sp->srcu_gp_mutex);
1145+ mutex_unlock(&ssp->srcu_gp_mutex);
11461146 return; /* Someone else started the grace period. */
11471147 }
11481148 }
11491149
1150− if (rcu_seq_state(READ_ONCE(sp->srcu_gp_seq)) == SRCU_STATE_SCAN1) {
1151− idx = 1 ^ (sp->srcu_idx & 1);
1152− if (!try_check_zero(sp, idx, 1)) {
1153− mutex_unlock(&sp->srcu_gp_mutex);
1150+ if (rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq)) == SRCU_STATE_SCAN1) {
1151+ idx = 1 ^ (ssp->srcu_idx & 1);
1152+ if (!try_check_zero(ssp, idx, 1)) {
1153+ mutex_unlock(&ssp->srcu_gp_mutex);
11541154 return; /* readers present, retry later. */
11551155 }
1156− srcu_flip(sp);
1157− rcu_seq_set_state(&sp->srcu_gp_seq, SRCU_STATE_SCAN2);
1156+ srcu_flip(ssp);
1157+ rcu_seq_set_state(&ssp->srcu_gp_seq, SRCU_STATE_SCAN2);
11581158 }
11591159
1160− if (rcu_seq_state(READ_ONCE(sp->srcu_gp_seq)) == SRCU_STATE_SCAN2) {
1160+ if (rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq)) == SRCU_STATE_SCAN2) {
11611161
11621162 /*
11631163 * SRCU read-side critical sections are normally short,
11641164 * so check at least twice in quick succession after a flip.
11651165 */
1166− idx = 1 ^ (sp->srcu_idx & 1);
1167− if (!try_check_zero(sp, idx, 2)) {
1168− mutex_unlock(&sp->srcu_gp_mutex);
1166+ idx = 1 ^ (ssp->srcu_idx & 1);
1167+ if (!try_check_zero(ssp, idx, 2)) {
1168+ mutex_unlock(&ssp->srcu_gp_mutex);
11691169 return; /* readers present, retry later. */
11701170 }
1171− srcu_gp_end(sp); /* Releases ->srcu_gp_mutex. */
1171+ srcu_gp_end(ssp); /* Releases ->srcu_gp_mutex. */
11721172 }
11731173 }
11741174
@@ -1184,14 +1184,14 @@ static void srcu_invoke_callbacks(struct work_struct *work) · 9 unmodified lines
11841184 struct rcu_cblist ready_cbs;
11851185 struct rcu_head *rhp;
11861186 struct srcu_data *sdp;
1187− struct srcu_struct *sp;
1187+ struct srcu_struct *ssp;
11881188
11891189 sdp = container_of(work, struct srcu_data, work.work);
1190− sp = sdp->sp;
1190+ ssp = sdp->ssp;
11911191 rcu_cblist_init(&ready_cbs);
11921192 spin_lock_irq_rcu_node(sdp);
11931193 rcu_segcblist_advance(&sdp->srcu_cblist,
1194− rcu_seq_current(&sp->srcu_gp_seq));
1194+ rcu_seq_current(&ssp->srcu_gp_seq));
11951195 if (sdp->srcu_cblist_invoking ||
11961196 !rcu_segcblist_ready_cbs(&sdp->srcu_cblist)) {
11971197 spin_unlock_irq_rcu_node(sdp);
@@ -1217,7 +1217,7 @@ static void srcu_invoke_callbacks(struct work_struct *work) · 19 unmodified lines
12171217 spin_lock_irq_rcu_node(sdp);
12181218 rcu_segcblist_insert_count(&sdp->srcu_cblist, &ready_cbs);
12191219 (void)rcu_segcblist_accelerate(&sdp->srcu_cblist,
1220− rcu_seq_snap(&sp->srcu_gp_seq));
1220+ rcu_seq_snap(&ssp->srcu_gp_seq));
12211221 sdp->srcu_cblist_invoking = false;
12221222 more = rcu_segcblist_ready_cbs(&sdp->srcu_cblist);
12231223 spin_unlock_irq_rcu_node(sdp);
@@ -1229,24 +1229,24 @@ static void srcu_invoke_callbacks(struct work_struct *work) · 5 unmodified lines
12291229 * Finished one round of SRCU grace period. Start another if there are
12301230 * more SRCU callbacks queued, otherwise put SRCU into not-running state.
12311231 */
1232−static void srcu_reschedule(struct srcu_struct *sp, unsigned long delay)
1232+static void srcu_reschedule(struct srcu_struct *ssp, unsigned long delay)
12331233 {
12341234 bool pushgp = true;
12351235
1236− spin_lock_irq_rcu_node(sp);
1237− if (ULONG_CMP_GE(sp->srcu_gp_seq, sp->srcu_gp_seq_needed)) {
1238− if (!WARN_ON_ONCE(rcu_seq_state(sp->srcu_gp_seq))) {
1236+ spin_lock_irq_rcu_node(ssp);
1237+ if (ULONG_CMP_GE(ssp->srcu_gp_seq, ssp->srcu_gp_seq_needed)) {
1238+ if (!WARN_ON_ONCE(rcu_seq_state(ssp->srcu_gp_seq))) {
12391239 /* All requests fulfilled, time to go idle. */
12401240 pushgp = false;
12411241 }
1242− } else if (!rcu_seq_state(sp->srcu_gp_seq)) {
1242+ } else if (!rcu_seq_state(ssp->srcu_gp_seq)) {
12431243 /* Outstanding request and no GP. Start one. */
1244− srcu_gp_start(sp);
1244+ srcu_gp_start(ssp);
12451245 }
1246− spin_unlock_irq_rcu_node(sp);
1246+ spin_unlock_irq_rcu_node(ssp);
12471247
12481248 if (pushgp)
1249− queue_delayed_work(rcu_gp_wq, &sp->work, delay);
1249+ queue_delayed_work(rcu_gp_wq, &ssp->work, delay);
12501250 }
12511251
12521252 /*
@@ -1254,41 +1254,41 @@ static void srcu_reschedule(struct srcu_struct *sp, unsigned long delay) · 1 unmodified line
12541254 */
12551255 static void process_srcu(struct work_struct *work)
12561256 {
1257− struct srcu_struct *sp;
1257+ struct srcu_struct *ssp;
12581258
1259− sp = container_of(work, struct srcu_struct, work.work);
1259+ ssp = container_of(work, struct srcu_struct, work.work);
12601260
1261− srcu_advance_state(sp);
1262− srcu_reschedule(sp, srcu_get_delay(sp));
1261+ srcu_advance_state(ssp);
1262+ srcu_reschedule(ssp, srcu_get_delay(ssp));
12631263 }
12641264
12651265 void srcutorture_get_gp_data(enum rcutorture_type test_type,
1266− struct srcu_struct *sp, int *flags,
1266+ struct srcu_struct *ssp, int *flags,
12671267 unsigned long *gp_seq)
12681268 {
12691269 if (test_type != SRCU_FLAVOR)
12701270 return;
12711271 *flags = 0;
1272− *gp_seq = rcu_seq_current(&sp->srcu_gp_seq);
1272+ *gp_seq = rcu_seq_current(&ssp->srcu_gp_seq);
12731273 }
12741274 EXPORT_SYMBOL_GPL(srcutorture_get_gp_data);
12751275
1276−void srcu_torture_stats_print(struct srcu_struct *sp, char *tt, char *tf)
1276+void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf)
12771277 {
12781278 int cpu;
12791279 int idx;
12801280 unsigned long s0 = 0, s1 = 0;
12811281
1282− idx = sp->srcu_idx & 0x1;
1282+ idx = ssp->srcu_idx & 0x1;
12831283 pr_alert("%s%s Tree SRCU g%ld per-CPU(idx=%d):",
1284− tt, tf, rcu_seq_current(&sp->srcu_gp_seq), idx);
1284+ tt, tf, rcu_seq_current(&ssp->srcu_gp_seq), idx);
12851285 for_each_possible_cpu(cpu) {
12861286 unsigned long l0, l1;
12871287 unsigned long u0, u1;
12881288 long c0, c1;
12891289 struct srcu_data *sdp;
12901290
1291− sdp = per_cpu_ptr(sp->sda, cpu);
1291+ sdp = per_cpu_ptr(ssp->sda, cpu);
12921292 u0 = sdp->srcu_unlock_count[!idx];
12931293 u1 = sdp->srcu_unlock_count[idx];
12941294
@@ -1323,14 +1323,14 @@ early_initcall(srcu_bootup_announce); · 28 unmodified lines
13231323
13241324 void __init srcu_init(void)
13251325 {
1326− struct srcu_struct *sp;
1326+ struct srcu_struct *ssp;
13271327
13281328 srcu_init_done = true;
13291329 while (!list_empty(&srcu_boot_list)) {
1330− sp = list_first_entry(&srcu_boot_list, struct srcu_struct,
1330+ ssp = list_first_entry(&srcu_boot_list, struct srcu_struct,
13311331 work.work.entry);
1332− check_init_srcu_struct(sp);
1333− list_del_init(&sp->work.work.entry);
1334− queue_work(rcu_gp_wq, &sp->work.work);
1332+ check_init_srcu_struct(ssp);
1333+ list_del_init(&ssp->work.work.entry);
1334+ queue_work(rcu_gp_wq, &ssp->work.work);
13351335 }
13361336 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t