Skip to content

Commit b0a6ead

Browse files
rafaeljwopsiff
authored andcommitted
Revert "cpuidle: menu: Avoid discarding useful information"
stable inclusion from stable-v6.6.115 category: bugfix commit 10fad40 upstream. It is reported that commit 85975da ("cpuidle: menu: Avoid discarding useful information") led to a performance regression on Intel Jasper Lake systems because it reduced the time spent by CPUs in idle state C7 which is correlated to the maximum frequency the CPUs can get to because of an average running power limit [1]. Before that commit, get_typical_interval() would have returned UINT_MAX whenever it had been unable to make a high-confidence prediction which had led to selecting the deepest available idle state too often and both power and performance had been inadequate as a result of that on some systems. However, this had not been a problem on systems with relatively aggressive average running power limits, like the Jasper Lake systems in question, because on those systems it was compensated by the ability to run CPUs faster. It was addressed by causing get_typical_interval() to return a number based on the recent idle duration information available to it even if it could not make a high-confidence prediction, but that clearly did not take the possible correlation between idle power and available CPU capacity into account. For this reason, revert most of the changes made by commit 85975da, except for one cosmetic cleanup, and add a comment explaining the rationale for returning UINT_MAX from get_typical_interval() when it is unable to make a high-confidence prediction. Fixes: 85975da ("cpuidle: menu: Avoid discarding useful information") Closes: https://lore.kernel.org/linux-pm/36iykr223vmcfsoysexug6s274nq2oimcu55ybn6ww4il3g3cv@cohflgdbpnq7/ [1] Reported-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/3663603.iIbC2pHGDl@rafael.j.wysocki Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 29d96bcc1495260ada5aae073b8939d7afcecc16) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent d9962ab commit b0a6ead

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

  • drivers/cpuidle/governors

drivers/cpuidle/governors/menu.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,17 @@ static unsigned int get_typical_interval(struct menu_device *data)
230230
*
231231
* This can deal with workloads that have long pauses interspersed
232232
* with sporadic activity with a bunch of short pauses.
233+
*
234+
* However, if the number of remaining samples is too small to exclude
235+
* any more outliers, allow the deepest available idle state to be
236+
* selected because there are systems where the time spent by CPUs in
237+
* deep idle states is correlated to the maximum frequency the CPUs
238+
* can get to. On those systems, shallow idle states should be avoided
239+
* unless there is a clear indication that the given CPU is most likley
240+
* going to be woken up shortly.
233241
*/
234-
if (divisor * 4 <= INTERVALS * 3) {
235-
/*
236-
* If there are sufficiently many data points still under
237-
* consideration after the outliers have been eliminated,
238-
* returning without a prediction would be a mistake because it
239-
* is likely that the next interval will not exceed the current
240-
* maximum, so return the latter in that case.
241-
*/
242-
if (divisor >= INTERVALS / 2)
243-
return max;
244-
242+
if (divisor * 4 <= INTERVALS * 3)
245243
return UINT_MAX;
246-
}
247244

248245
thresh = max - 1;
249246
goto again;

0 commit comments

Comments
 (0)