Skip to content

Commit 6a2c025

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
refscale: Add srcu_read_lock_lite() support using "srcu-lite"
This commit creates a new srcu-lite option for the refscale.scale_type module parameter that selects srcu_read_lock_lite() and srcu_read_unlock_lite(). [ paulmck: Apply Dan Carpenter feedback. ] Signed-off-by: Paul E. McKenney <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: <[email protected]> Reviewed-by: Neeraj Upadhyay <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 930d4e1 commit 6a2c025

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

kernel/rcu/refscale.c

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,36 @@ static const struct ref_scale_ops srcu_ops = {
212212
.name = "srcu"
213213
};
214214

215+
static void srcu_lite_ref_scale_read_section(const int nloops)
216+
{
217+
int i;
218+
int idx;
219+
220+
for (i = nloops; i >= 0; i--) {
221+
idx = srcu_read_lock_lite(srcu_ctlp);
222+
srcu_read_unlock_lite(srcu_ctlp, idx);
223+
}
224+
}
225+
226+
static void srcu_lite_ref_scale_delay_section(const int nloops, const int udl, const int ndl)
227+
{
228+
int i;
229+
int idx;
230+
231+
for (i = nloops; i >= 0; i--) {
232+
idx = srcu_read_lock_lite(srcu_ctlp);
233+
un_delay(udl, ndl);
234+
srcu_read_unlock_lite(srcu_ctlp, idx);
235+
}
236+
}
237+
238+
static const struct ref_scale_ops srcu_lite_ops = {
239+
.init = rcu_sync_scale_init,
240+
.readsection = srcu_lite_ref_scale_read_section,
241+
.delaysection = srcu_lite_ref_scale_delay_section,
242+
.name = "srcu-lite"
243+
};
244+
215245
#ifdef CONFIG_TASKS_RCU
216246

217247
// Definitions for RCU Tasks ref scale testing: Empty read markers.
@@ -1082,9 +1112,10 @@ ref_scale_init(void)
10821112
long i;
10831113
int firsterr = 0;
10841114
static const struct ref_scale_ops *scale_ops[] = {
1085-
&rcu_ops, &srcu_ops, RCU_TRACE_OPS RCU_TASKS_OPS &refcnt_ops, &rwlock_ops,
1086-
&rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops, &clock_ops, &jiffies_ops,
1087-
&typesafe_ref_ops, &typesafe_lock_ops, &typesafe_seqlock_ops,
1115+
&rcu_ops, &srcu_ops, &srcu_lite_ops, RCU_TRACE_OPS RCU_TASKS_OPS
1116+
&refcnt_ops, &rwlock_ops, &rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops,
1117+
&clock_ops, &jiffies_ops, &typesafe_ref_ops, &typesafe_lock_ops,
1118+
&typesafe_seqlock_ops,
10881119
};
10891120

10901121
if (!torture_init_begin(scale_type, verbose))

0 commit comments

Comments
 (0)