]> git.ipfire.org Git - thirdparty/linux.git/commit
cpuidle: governors: teo: Refine intercepts-based idle state lookup
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 29 Jan 2026 20:51:11 +0000 (21:51 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 30 Jan 2026 19:15:52 +0000 (20:15 +0100)
commita971f984b8455db0ef23910442029cdad53bc459
treeff413ce0bdf51e289564a81edaf4309c09c89569
parentf36de72673ad80c9931c0b411df0d6ef184f6c22
cpuidle: governors: teo: Refine intercepts-based idle state lookup

There are cases in which decisions made by the teo governor are
arguably overly conservative.

For instance, suppose that there are 4 idle states and the values of
the intercepts metric for the first 3 of them are 400, 250, and 251,
respectively.  If the total sum computed in teo_update() is 1000, the
governor will select idle state 1 (provided that all idle states are
enabled and the scheduler tick has not been stopped) although arguably
idle state 0 would be a better choice because the likelihood of getting
an idle duration below the target residency of idle state 1 is greater
than the likelihood of getting an idle duration between the target
residency of idle state 1 and the target residency of idle state 2.

To address this, refine the candidate idle state lookup based on
intercepts to start at the state with the maximum intercepts metric,
below the deepest enabled one, to avoid the cases in which the search
may stop before reaching that state.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
[ rjw: Fixed typo "intercetps" in new comments (3 places) ]
Link: https://patch.msgid.link/2417298.ElGaqSPkdT@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governors/teo.c