Skip to content

Commit 7b6c164

Browse files
paulmckrcuurezki
authored andcommitted
rcutorture: Use finer-grained timeouts for rcu_torture_writer() polling
The rcu_torture_writer() polling currently uses timeouts ranging from zero to 16 milliseconds to wait for the polled grace period to end. This works, but it would be better to have a higher probability of exercising races with the code that cleans up after a grace period. This commit therefore switches from these millisecond-scale timeouts to timeouts ranging from zero to 128 microseconds, and with a full microsecond's worth of timeout fuzz. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
1 parent 579a05d commit 7b6c164

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

kernel/rcu/rcutorture.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,8 +1561,8 @@ rcu_torture_writer(void *arg)
15611561
break;
15621562
}
15631563
WARN_ON_ONCE(ulo_size > 0 && i >= ulo_size);
1564-
torture_hrtimeout_jiffies(torture_random(&rand) % 16,
1565-
&rand);
1564+
torture_hrtimeout_us(torture_random(&rand) % 128, 1000,
1565+
&rand);
15661566
}
15671567
rcu_torture_pipe_update(old_rp);
15681568
break;
@@ -1582,8 +1582,8 @@ rcu_torture_writer(void *arg)
15821582
break;
15831583
}
15841584
WARN_ON_ONCE(rgo_size > 0 && i >= rgo_size);
1585-
torture_hrtimeout_jiffies(torture_random(&rand) % 16,
1586-
&rand);
1585+
torture_hrtimeout_us(torture_random(&rand) % 128, 1000,
1586+
&rand);
15871587
}
15881588
rcu_torture_pipe_update(old_rp);
15891589
break;
@@ -1592,17 +1592,17 @@ rcu_torture_writer(void *arg)
15921592
gp_snap = cur_ops->start_gp_poll_exp();
15931593
rcu_torture_writer_state = RTWS_POLL_WAIT_EXP;
15941594
while (!cur_ops->poll_gp_state_exp(gp_snap))
1595-
torture_hrtimeout_jiffies(torture_random(&rand) % 16,
1596-
&rand);
1595+
torture_hrtimeout_us(torture_random(&rand) % 128, 1000,
1596+
&rand);
15971597
rcu_torture_pipe_update(old_rp);
15981598
break;
15991599
case RTWS_POLL_GET_EXP_FULL:
16001600
rcu_torture_writer_state = RTWS_POLL_GET_EXP_FULL;
16011601
cur_ops->start_gp_poll_exp_full(&gp_snap_full);
16021602
rcu_torture_writer_state = RTWS_POLL_WAIT_EXP_FULL;
16031603
while (!cur_ops->poll_gp_state_full(&gp_snap_full))
1604-
torture_hrtimeout_jiffies(torture_random(&rand) % 16,
1605-
&rand);
1604+
torture_hrtimeout_us(torture_random(&rand) % 128, 1000,
1605+
&rand);
16061606
rcu_torture_pipe_update(old_rp);
16071607
break;
16081608
case RTWS_SYNC:

0 commit comments

Comments
 (0)