rcu: Use idle versions of swait to make idle-hack clear
These RCU waits were set to use interruptible waits to avoid the kthreads contributing to system load average, even though they are not interruptible as they are spawned from a kthread. Use the new TASK_IDLE swaits which makes our goal clear, and removes confusion about these paths possibly being interruptible -- they are not. When the system is idle the RCU grace-period kthread will spend all its time blocked inside the swait_event_interruptible(). If the interruptible() was not used, then this kthread would contribute to the load average. This means that an idle system would have a load average of 2 (or 3 if PREEMPT=y), rather than the load average of 0 that almost fifty years of UNIX has conditioned sysadmins to expect. The same argument applies to swait_event_interruptible_timeout() use. The RCU grace-period kthread spends its time blocked inside this call while waiting for grace periods to complete. In particular, if there was only one busy CPU, but that CPU was frequently invoking call_rcu(), then the RCU grace-period kthread would spend almost all its time blocked inside the swait_event_interruptible_timeout(). This would mean that the load average would be 2 rather than the expected 1 for the single busy CPU. Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
352eee1242
commit
d5374226c3
|
@ -2067,8 +2067,8 @@ static bool rcu_gp_init(struct rcu_state *rsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function for wait_event_interruptible_timeout() wakeup
|
* Helper function for swait_event_idle() wakeup at force-quiescent-state
|
||||||
* at force-quiescent-state time.
|
* time.
|
||||||
*/
|
*/
|
||||||
static bool rcu_gp_fqs_check_wake(struct rcu_state *rsp, int *gfp)
|
static bool rcu_gp_fqs_check_wake(struct rcu_state *rsp, int *gfp)
|
||||||
{
|
{
|
||||||
|
@ -2206,9 +2206,8 @@ static int __noreturn rcu_gp_kthread(void *arg)
|
||||||
READ_ONCE(rsp->gpnum),
|
READ_ONCE(rsp->gpnum),
|
||||||
TPS("reqwait"));
|
TPS("reqwait"));
|
||||||
rsp->gp_state = RCU_GP_WAIT_GPS;
|
rsp->gp_state = RCU_GP_WAIT_GPS;
|
||||||
swait_event_interruptible(rsp->gp_wq,
|
swait_event_idle(rsp->gp_wq, READ_ONCE(rsp->gp_flags) &
|
||||||
READ_ONCE(rsp->gp_flags) &
|
RCU_GP_FLAG_INIT);
|
||||||
RCU_GP_FLAG_INIT);
|
|
||||||
rsp->gp_state = RCU_GP_DONE_GPS;
|
rsp->gp_state = RCU_GP_DONE_GPS;
|
||||||
/* Locking provides needed memory barrier. */
|
/* Locking provides needed memory barrier. */
|
||||||
if (rcu_gp_init(rsp))
|
if (rcu_gp_init(rsp))
|
||||||
|
@ -2239,7 +2238,7 @@ static int __noreturn rcu_gp_kthread(void *arg)
|
||||||
READ_ONCE(rsp->gpnum),
|
READ_ONCE(rsp->gpnum),
|
||||||
TPS("fqswait"));
|
TPS("fqswait"));
|
||||||
rsp->gp_state = RCU_GP_WAIT_FQS;
|
rsp->gp_state = RCU_GP_WAIT_FQS;
|
||||||
ret = swait_event_interruptible_timeout(rsp->gp_wq,
|
ret = swait_event_idle_timeout(rsp->gp_wq,
|
||||||
rcu_gp_fqs_check_wake(rsp, &gf), j);
|
rcu_gp_fqs_check_wake(rsp, &gf), j);
|
||||||
rsp->gp_state = RCU_GP_DOING_FQS;
|
rsp->gp_state = RCU_GP_DOING_FQS;
|
||||||
/* Locking provides needed memory barriers. */
|
/* Locking provides needed memory barriers. */
|
||||||
|
|
Loading…
Reference in New Issue