Skip to content

Commit 8fc2878

Browse files
committed
refperf: Convert nreaders to a module parameter
This commit converts nreaders to a module parameter, with the default of -1 specifying the old behavior of using 75% of the readers. Cc: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 83b88c8 commit 8fc2878

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

kernel/rcu/refperf.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ torture_param(int, holdoff, IS_BUILTIN(CONFIG_RCU_REF_PERF_TEST) ? 10 : 0,
6262
"Holdoff time before test start (s)");
6363
// Number of loops per experiment, all readers execute operations concurrently.
6464
torture_param(long, loops, 10000000, "Number of loops per experiment.");
65+
// Number of readers, with -1 defaulting to about 75% of the CPUs.
66+
torture_param(int, nreaders, -1, "Number of readers, -1 for 75% of CPUs.");
67+
// Number of runs.
68+
torture_param(int, nruns, 30, "Number of experiments to run.");
69+
// Reader delay in nanoseconds, 0 for no delay.
70+
torture_param(int, readdelay, 0, "Read-side delay in nanoseconds.");
6571

6672
#ifdef MODULE
6773
# define REFPERF_SHUTDOWN 0
@@ -93,7 +99,6 @@ static wait_queue_head_t main_wq;
9399
static int shutdown_start;
94100

95101
static struct reader_task *reader_tasks;
96-
static int nreaders;
97102

98103
// Number of readers that are part of the current experiment.
99104
static atomic_t nreaders_exp;
@@ -411,8 +416,8 @@ static void
411416
ref_perf_print_module_parms(struct ref_perf_ops *cur_ops, const char *tag)
412417
{
413418
pr_alert("%s" PERF_FLAG
414-
"--- %s: verbose=%d shutdown=%d holdoff=%d loops=%ld\n", perf_type, tag,
415-
verbose, shutdown, holdoff, loops);
419+
"--- %s: verbose=%d shutdown=%d holdoff=%d loops=%ld nreaders=%d\n", perf_type, tag,
420+
verbose, shutdown, holdoff, loops, nreaders);
416421
}
417422

418423
static void
@@ -501,8 +506,9 @@ ref_perf_init(void)
501506
schedule_timeout_uninterruptible(1);
502507
}
503508

504-
// Reader tasks (~75% of online CPUs).
505-
nreaders = (num_online_cpus() >> 1) + (num_online_cpus() >> 2);
509+
// Reader tasks (default to ~75% of online CPUs).
510+
if (nreaders < 0)
511+
nreaders = (num_online_cpus() >> 1) + (num_online_cpus() >> 2);
506512
reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
507513
GFP_KERNEL);
508514
if (!reader_tasks) {

0 commit comments

Comments
 (0)