Skip to content

Commit 72bb749

Browse files
committed
refperf: Add test for RCU Tasks Trace readers.
This commit adds testing for RCU Tasks Trace readers to the refperf module. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 918b351 commit 72bb749

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

kernel/rcu/refperf.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/notifier.h>
2626
#include <linux/percpu.h>
2727
#include <linux/rcupdate.h>
28+
#include <linux/rcupdate_trace.h>
2829
#include <linux/reboot.h>
2930
#include <linux/sched.h>
3031
#include <linux/spinlock.h>
@@ -157,7 +158,6 @@ static struct ref_perf_ops rcu_ops = {
157158
.name = "rcu"
158159
};
159160

160-
161161
// Definitions for SRCU ref perf testing.
162162
DEFINE_STATIC_SRCU(srcu_refctl_perf);
163163
static struct srcu_struct *srcu_ctlp = &srcu_refctl_perf;
@@ -192,6 +192,35 @@ static struct ref_perf_ops srcu_ops = {
192192
.name = "srcu"
193193
};
194194

195+
// Definitions for RCU Tasks Trace ref perf testing.
196+
static void rcu_trace_ref_perf_read_section(const int nloops)
197+
{
198+
int i;
199+
200+
for (i = nloops; i >= 0; i--) {
201+
rcu_read_lock_trace();
202+
rcu_read_unlock_trace();
203+
}
204+
}
205+
206+
static void rcu_trace_ref_perf_delay_section(const int nloops, const int udl, const int ndl)
207+
{
208+
int i;
209+
210+
for (i = nloops; i >= 0; i--) {
211+
rcu_read_lock_trace();
212+
un_delay(udl, ndl);
213+
rcu_read_unlock_trace();
214+
}
215+
}
216+
217+
static struct ref_perf_ops rcu_trace_ops = {
218+
.init = rcu_sync_perf_init,
219+
.readsection = rcu_trace_ref_perf_read_section,
220+
.delaysection = rcu_trace_ref_perf_delay_section,
221+
.name = "rcu-trace"
222+
};
223+
195224
// Definitions for reference count
196225
static atomic_t refcnt;
197226

@@ -584,7 +613,7 @@ ref_perf_init(void)
584613
long i;
585614
int firsterr = 0;
586615
static struct ref_perf_ops *perf_ops[] = {
587-
&rcu_ops, &srcu_ops, &refcnt_ops, &rwlock_ops, &rwsem_ops,
616+
&rcu_ops, &srcu_ops, &rcu_trace_ops, &refcnt_ops, &rwlock_ops, &rwsem_ops,
588617
};
589618

590619
if (!torture_init_begin(perf_type, verbose))

0 commit comments

Comments
 (0)