rcutorture: Don't count CPU-stalled time against priority boosting
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 14 Apr 2021 20:00:10 +0000 (13:00 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 10 May 2021 23:05:07 +0000 (16:05 -0700)
commit063f5a4df99145ba0a5d4879d171a8175235f37b
tree71dbfa274cc1d7780ca193bd502591425372ab6d
parent0260b92e1c39412b1e345e202355c43169c16274
rcutorture: Don't count CPU-stalled time against priority boosting

It will frequently be the case that rcu_torture_boost() will get a
->start_gp_poll() cookie that needs almost all of the current grace period
plus an additional grace period to elapse before ->poll_gp_state() will
return true.  It is quite possible that the current grace period will have
(say) two seconds of stall by a CPU failing to pass through a quiescent
state, followed by 300 milliseconds of delay due to a preempted reader.
The next grace period might suffer only one second of stall by a CPU,
followed by another 300 milliseconds of delay due to a preempted reader.
This is an example of RCU priority boosting doing its job, but the full
elapsed time of 3.6 seconds exceeds the 3.5-second limit.  In addition,
there is no CPU stall in force at the 3.5-second mark, so this would
nevertheless currently be counted as an RCU priority boosting failure.

This commit therefore avoids this sort of false positive by resetting
the gp_state_time timestamp any time that the current grace period is
being blocked by a CPU.  This results in extremely frequent calls to
the ->check_boost_failed() function, so this commit provides a lockless
fastpath that is selected by supplying a NULL CPU-number pointer.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcutorture.c
kernel/rcu/tree_stall.h