Skip to content

Commit b8726c5

Browse files
paulmckrcufbq
authored andcommitted
rcutorture: Add a test_boost_holdoff module parameter
This commit adds a test_boost_holdoff module parameter that tells the RCU priority-boosting tests to wait for the specified number of seconds past the start of the rcutorture test. This can be useful when rcutorture is built into the kernel (as opposed to being modprobed), especially on large systems where early start of RCU priority boosting can delay the boot sequence, which adds a full CPU's worth of load onto the system. This can in turn result in pointless stall warnings. Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Boqun Feng <[email protected]>
1 parent 623b528 commit b8726c5

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5758,6 +5758,11 @@
57585758
rcutorture.test_boost_duration= [KNL]
57595759
Duration (s) of each individual boost test.
57605760

5761+
rcutorture.test_boost_holdoff= [KNL]
5762+
Holdoff time (s) from start of test to the start
5763+
of RCU priority-boost testing. Defaults to zero,
5764+
that is, no holdoff.
5765+
57615766
rcutorture.test_boost_interval= [KNL]
57625767
Interval (s) between each boost test.
57635768

kernel/rcu/rcutorture.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ torture_param(int, stat_interval, 60, "Number of seconds between stats printk()s
135135
torture_param(int, stutter, 5, "Number of seconds to run/halt test");
136136
torture_param(int, test_boost, 1, "Test RCU prio boost: 0=no, 1=maybe, 2=yes.");
137137
torture_param(int, test_boost_duration, 4, "Duration of each boost test, seconds.");
138+
torture_param(int, test_boost_holdoff, 0, "Holdoff time from rcutorture start, seconds.");
138139
torture_param(int, test_boost_interval, 7, "Interval between boost tests, seconds.");
139140
torture_param(int, test_nmis, 0, "End-test NMI tests, 0 to disable.");
140141
torture_param(bool, test_no_idle_hz, true, "Test support for tickless idle CPUs");
@@ -1148,8 +1149,19 @@ static int rcu_torture_boost(void *arg)
11481149
unsigned long gp_state;
11491150
unsigned long gp_state_time;
11501151
unsigned long oldstarttime;
1152+
unsigned long booststarttime = get_torture_init_jiffies() + test_boost_holdoff * HZ;
11511153

1152-
VERBOSE_TOROUT_STRING("rcu_torture_boost started");
1154+
if (test_boost_holdoff <= 0 || time_after(jiffies, booststarttime)) {
1155+
VERBOSE_TOROUT_STRING("rcu_torture_boost started");
1156+
} else {
1157+
VERBOSE_TOROUT_STRING("rcu_torture_boost started holdoff period");
1158+
while (time_before(jiffies, booststarttime)) {
1159+
schedule_timeout_idle(HZ);
1160+
if (kthread_should_stop())
1161+
goto cleanup;
1162+
}
1163+
VERBOSE_TOROUT_STRING("rcu_torture_boost finished holdoff period");
1164+
}
11531165

11541166
/* Set real-time priority. */
11551167
sched_set_fifo_low(current);
@@ -1225,6 +1237,7 @@ checkwait: if (stutter_wait("rcu_torture_boost"))
12251237
sched_set_fifo_low(current);
12261238
} while (!torture_must_stop());
12271239

1240+
cleanup:
12281241
/* Clean up and exit. */
12291242
while (!kthread_should_stop()) {
12301243
torture_shutdown_absorb("rcu_torture_boost");
@@ -2512,7 +2525,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
25122525
"shuffle_interval=%d stutter=%d irqreader=%d "
25132526
"fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d "
25142527
"test_boost=%d/%d test_boost_interval=%d "
2515-
"test_boost_duration=%d shutdown_secs=%d "
2528+
"test_boost_duration=%d test_boost_holdoff=%d shutdown_secs=%d "
25162529
"stall_cpu=%d stall_cpu_holdoff=%d stall_cpu_irqsoff=%d "
25172530
"stall_cpu_block=%d stall_cpu_repeat=%d "
25182531
"n_barrier_cbs=%d "
@@ -2526,7 +2539,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)
25262539
stat_interval, verbose, test_no_idle_hz, shuffle_interval,
25272540
stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter,
25282541
test_boost, cur_ops->can_boost,
2529-
test_boost_interval, test_boost_duration, shutdown_secs,
2542+
test_boost_interval, test_boost_duration, test_boost_holdoff, shutdown_secs,
25302543
stall_cpu, stall_cpu_holdoff, stall_cpu_irqsoff,
25312544
stall_cpu_block, stall_cpu_repeat,
25322545
n_barrier_cbs,

0 commit comments

Comments
 (0)