Commit 1eba0ef9 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

rcutorture: Use hrtimers for reader and writer delays



This commit replaces schedule_timeout_uninterruptible() and
schedule_timeout_interruptible() with torture_hrtimeout_us() and
torture_hrtimeout_jiffies() to avoid timer-wheel synchronization.

Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent ed24affa
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -1149,7 +1149,7 @@ rcu_torture_writer(void *arg)


	do {
	do {
		rcu_torture_writer_state = RTWS_FIXED_DELAY;
		rcu_torture_writer_state = RTWS_FIXED_DELAY;
		schedule_timeout_uninterruptible(1);
		torture_hrtimeout_us(500, 1000, &rand);
		rp = rcu_torture_alloc();
		rp = rcu_torture_alloc();
		if (rp == NULL)
		if (rp == NULL)
			continue;
			continue;
@@ -1290,8 +1290,7 @@ rcu_torture_fakewriter(void *arg)
	set_user_nice(current, MAX_NICE);
	set_user_nice(current, MAX_NICE);


	do {
	do {
		schedule_timeout_uninterruptible(1 + torture_random(&rand)%10);
		torture_hrtimeout_jiffies(torture_random(&rand) % 10, &rand);
		udelay(torture_random(&rand) & 0x3ff);
		if (cur_ops->cb_barrier != NULL &&
		if (cur_ops->cb_barrier != NULL &&
		    torture_random(&rand) % (nfakewriters * 8) == 0) {
		    torture_random(&rand) % (nfakewriters * 8) == 0) {
			cur_ops->cb_barrier();
			cur_ops->cb_barrier();
@@ -1656,7 +1655,7 @@ rcu_torture_reader(void *arg)
		if (!rcu_torture_one_read(&rand, myid) && !torture_must_stop())
		if (!rcu_torture_one_read(&rand, myid) && !torture_must_stop())
			schedule_timeout_interruptible(HZ);
			schedule_timeout_interruptible(HZ);
		if (time_after(jiffies, lastsleep) && !torture_must_stop()) {
		if (time_after(jiffies, lastsleep) && !torture_must_stop()) {
			schedule_timeout_interruptible(1);
			torture_hrtimeout_us(500, 1000, &rand);
			lastsleep = jiffies + 10;
			lastsleep = jiffies + 10;
		}
		}
		while (num_online_cpus() < mynumonline && !torture_must_stop())
		while (num_online_cpus() < mynumonline && !torture_must_stop())