Skip to content

Commit 2f611d0

Browse files
committed
scftorture: Allow zero weight to exclude an smp_call_function*() category
This commit reworks the weighting calculations to allow zero to be specified to disable a given weight. For example, specifying the scftorture.weight_resched=0 kernel boot parameter without specifying a non-zero value for any of the other scftorture.weight_* parameters would provide the default weights for the others, but would refrain from doing any resched-based IPIs. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 6880fa6 commit 2f611d0

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

kernel/scftorture.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -553,18 +553,18 @@ static int __init scf_torture_init(void)
553553

554554
scftorture_print_module_parms("Start of test");
555555

556-
if (weight_resched == -1 &&
557-
weight_single == -1 && weight_single_rpc == -1 && weight_single_wait == -1 &&
558-
weight_many == -1 && weight_many_wait == -1 &&
559-
weight_all == -1 && weight_all_wait == -1) {
560-
weight_resched1 = 2 * nr_cpu_ids;
561-
weight_single1 = 2 * nr_cpu_ids;
562-
weight_single_rpc1 = 2 * nr_cpu_ids;
563-
weight_single_wait1 = 2 * nr_cpu_ids;
564-
weight_many1 = 2;
565-
weight_many_wait1 = 2;
566-
weight_all1 = 1;
567-
weight_all_wait1 = 1;
556+
if (weight_resched <= 0 &&
557+
weight_single <= 0 && weight_single_rpc <= 0 && weight_single_wait <= 0 &&
558+
weight_many <= 0 && weight_many_wait <= 0 &&
559+
weight_all <= 0 && weight_all_wait <= 0) {
560+
weight_resched1 = weight_resched == 0 ? 0 : 2 * nr_cpu_ids;
561+
weight_single1 = weight_single == 0 ? 0 : 2 * nr_cpu_ids;
562+
weight_single_rpc1 = weight_single_rpc == 0 ? 0 : 2 * nr_cpu_ids;
563+
weight_single_wait1 = weight_single_wait == 0 ? 0 : 2 * nr_cpu_ids;
564+
weight_many1 = weight_many == 0 ? 0 : 2;
565+
weight_many_wait1 = weight_many_wait == 0 ? 0 : 2;
566+
weight_all1 = weight_all == 0 ? 0 : 1;
567+
weight_all_wait1 = weight_all_wait == 0 ? 0 : 1;
568568
} else {
569569
if (weight_resched == -1)
570570
weight_resched1 = 0;

0 commit comments

Comments
 (0)