Skip to content

Commit 6083653

Browse files
committed
cpuidle: governors: teo: Avoid fake intercepts produced by tick
Tick wakeups can lead to fake intercepts that may skew idle state selection towards shallow states, so it is better to avoid counting them as intercepts. For this purpose, add a check causing teo_update() to only count tick wakeups as intercepts if intercepts within the tick period range are at least twice as frequent as any other events. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/3404606.44csPzL39Z@rafael.j.wysocki
1 parent 4bd2221 commit 6083653

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • drivers/cpuidle/governors

drivers/cpuidle/governors/teo.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
239239
cpu_data->state_bins[drv->state_count-1].hits += PULSE;
240240
return;
241241
}
242+
/*
243+
* If intercepts within the tick period range are not frequent
244+
* enough, count this wakeup as a hit, since it is likely that
245+
* the tick has woken up the CPU because an expected intercept
246+
* was not there. Otherwise, one of the intercepts may have
247+
* been incidentally preceded by the tick wakeup.
248+
*/
249+
if (3 * cpu_data->tick_intercepts < 2 * total) {
250+
cpu_data->state_bins[idx_timer].hits += PULSE;
251+
return;
252+
}
242253
}
243254

244255
/*

0 commit comments

Comments
 (0)