Skip to content

Commit 777a54c

Browse files
committed
refperf: Add holdoff parameter to allow CPUs to come online
This commit adds an rcuperf module parameter named "holdoff" that defaults to 10 seconds if refperf is built in and to zero otherwise. The assumption is that all the CPUs are online by the time that the modprobe and insmod commands are going to do anything, and that normal systems will have all the CPUs online within ten seconds. Larger systems may take many tens of seconds or even minutes to get to this point, hence this being a module parameter instead of being a hard-coded constant. Cc: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent f8b4bb2 commit 777a54c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

kernel/rcu/refperf.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ MODULE_PARM_DESC(perf_type, "Type of test (rcu, srcu, refcnt, rwsem, rwlock.");
5757

5858
torture_param(int, verbose, 0, "Enable verbose debugging printk()s");
5959

60-
// Number of loops per experiment, all readers execute an operation concurrently
60+
// Wait until there are multiple CPUs before starting test.
61+
torture_param(int, holdoff, IS_BUILTIN(CONFIG_RCU_REF_PERF_TEST) ? 10 : 0,
62+
"Holdoff time before test start (s)");
63+
// Number of loops per experiment, all readers execute operations concurrently.
6164
torture_param(long, loops, 10000000, "Number of loops per experiment.");
6265

6366
#ifdef MODULE
@@ -248,6 +251,8 @@ ref_perf_reader(void *arg)
248251
set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
249252
set_user_nice(current, MAX_NICE);
250253
atomic_inc(&n_init);
254+
if (holdoff)
255+
schedule_timeout_interruptible(holdoff * HZ);
251256
repeat:
252257
VERBOSE_PERFOUT("ref_perf_reader %ld: waiting to start next experiment on cpu %d", me, smp_processor_id());
253258

@@ -357,6 +362,8 @@ static int main_func(void *arg)
357362

358363
// Wait for all threads to start.
359364
wait_event(main_wq, atomic_read(&n_init) == (nreaders + 1));
365+
if (holdoff)
366+
schedule_timeout_interruptible(holdoff * HZ);
360367

361368
// Start exp readers up per experiment
362369
for (exp = 0; exp < nreaders && !torture_must_stop(); exp++) {
@@ -420,8 +427,8 @@ static void
420427
ref_perf_print_module_parms(struct ref_perf_ops *cur_ops, const char *tag)
421428
{
422429
pr_alert("%s" PERF_FLAG
423-
"--- %s: verbose=%d shutdown=%d loops=%ld\n", perf_type, tag,
424-
verbose, shutdown, loops);
430+
"--- %s: verbose=%d shutdown=%d holdoff=%d loops=%ld\n", perf_type, tag,
431+
verbose, shutdown, holdoff, loops);
425432
}
426433

427434
static void

0 commit comments

Comments
 (0)