cpuidle: teo: Gather statistics regarding whether or not to stop the tick
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Aug 2023 21:11:40 +0000 (23:11 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Aug 2023 17:58:53 +0000 (19:58 +0200)
commit2662342079f54b8a940f7094c197c99458caeb0d
treed5142e37398951a734c6edec349d9292326ae2eb
parent6da8f9ba5a87f8aecf2cd4441cc6024a77e5b645
cpuidle: teo: Gather statistics regarding whether or not to stop the tick

Currently, if the target residency of the deepest idle state is less than
the tick period length, which is quite likely for HZ=100, and the deepest
idle state is about to be selected by the TEO idle governor, the decision
on whether or not to stop the scheduler tick is based entirely on the
time till the closest timer.  This is often insufficient, because timers
may not be in heavy use and there may be a plenty of other CPU wakeup
events between the deepest idle state's target residency and the closest
tick.

Allow the governor to count those events by making the deepest idle
state's bin effectively end at TICK_NSEC and introducing an additional
"bin" for collecting "hit" events (ie. the ones in which the measured
idle duration falls into the same bin as the time till the closest
timer) with idle duration values past TICK_NSEC.

This way the "intercepts" metric for the deepest idle state's bin
becomes nonzero in general, and so it can influence the decision on
whether or not to stop the tick possibly increasing the governor's
accuracy in that respect.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
Tested-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
drivers/cpuidle/governors/teo.c