sched/fair: Exempt paused CPU from nohz idle balance

A CPU can be paused while it is idle with it's tick stopped.
nohz_balance_exit_idle() should be called from the local CPU,
so it can't be called during pause which can happen remotely.
This results in paused CPU participating in the nohz idle balance,
which should be avoided. This can be done by calling

Fix this issue by calling nohz_balance_exit_idle() from the paused
CPU when it exits and enters idle again. This lazy approach avoids
waking the CPU from idle during pause.

Bug: 180530906
Change-Id: Ia2dfd9c9cac9b0f37c55a9256b9d5f3141ca0421
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Pavankumar Kondeti 2024-10-05 23:52:45 +05:30 committed by Richard Raya
parent ef222e3b72
commit 1a39ad5049

View File

@ -12057,11 +12057,20 @@ unlock:
*/
void nohz_balance_enter_idle(int cpu)
{
/*
* If this cpu is going down, then nothing needs to be done.
*/
if (!cpu_active(cpu))
if (!cpu_active(cpu)) {
/*
* A CPU can be paused while it is idle with it's tick
* stopped. nohz_balance_exit_idle() should be called
* from the local CPU, so it can't be called during
* pause. This results in paused CPU participating in
* the nohz idle balance, which should be avoided.
*
* When the paused CPU exits idle and enters again,
* exempt the paused CPU from nohz_balance_exit_idle.
*/
nohz_balance_exit_idle(cpu);
return;
}
/* Spare idle load balancing on CPUs that don't want to be disturbed: */
if (!is_housekeeping_cpu(cpu))