Skip to content

Commit a32d5a4

Browse files
Pavankumar KondetiPixelBoot
authored andcommitted
BACKPORT: ANDROID: sched: 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> [ Tashar02: Backport to k4.19 ] [ RealJohnGalt: Backport to k4.14 ] Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
1 parent 4aa03a0 commit a32d5a4

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

kernel/sched/fair.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9714,11 +9714,19 @@ void set_cpu_sd_state_idle(void)
97149714
*/
97159715
void nohz_balance_enter_idle(int cpu)
97169716
{
9717-
/*
9718-
* If this cpu is going down, then nothing needs to be done.
9719-
*/
9720-
if (!cpu_active(cpu))
9717+
if (!cpu_active(cpu)) {
9718+
/*
9719+
* A CPU can be paused while it is idle with it's tick
9720+
* stopped. nohz_balance_exit_idle() should be called
9721+
* from the local CPU, so it can't be called during
9722+
* pause. This results in paused CPU participating in
9723+
* the nohz idle balance, which should be avoided.
9724+
* When the paused CPU exits idle and enters again,
9725+
* exempt the paused CPU from nohz_balance_exit_idle.
9726+
*/
9727+
nohz_balance_exit_idle(cpu);
97219728
return;
9729+
}
97229730

97239731
if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
97249732
return;

0 commit comments

Comments
 (0)