-
Notifications
You must be signed in to change notification settings - Fork 102
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] Revert "cpuidle: menu: Avoid discarding useful information" #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-6.6.y
Are you sure you want to change the base?
Conversation
stable inclusion from stable-v6.6.115 category: bugfix commit 10fad4012234a7dea621ae17c0c9486824f645a0 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 <[email protected]> Cc: All applicable <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 29d96bcc1495260ada5aae073b8939d7afcecc16) Signed-off-by: Wentao Guan <[email protected]>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR reverts the upstream idle interval prediction changes introduced by commit 85975da in the cpuidle menu governor, restoring the behavior where get_typical_interval() returns UINT_MAX when confidence is low, and retains only a cosmetic cleanup and enhanced comment explaining this rationale. Class diagram for updated get_typical_interval() logic in menu governorclassDiagram
class menu_device
class get_typical_interval
get_typical_interval : +unsigned int get_typical_interval(menu_device *data)
menu_device <|-- get_typical_interval
get_typical_interval : returns UINT_MAX when confidence is low
get_typical_interval : enhanced comment explaining rationale
Flow diagram for get_typical_interval() decision logic after revertflowchart TD
A["Start: get_typical_interval()"] --> B["Check: divisor * 4 <= INTERVALS * 3"]
B -- Yes --> C["Return UINT_MAX"]
B -- No --> D["Continue: thresh = max - 1; goto again"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
deepin pr auto review我来分析一下这段代码的修改:
改进建议:
总体来说,这个修改是为了解决特定场景下的问题,但可能会影响其他场景的性能表现。建议在实际部署前进行充分的测试和性能评估。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request reverts a previous commit (85975da) that caused performance regressions on Intel Jasper Lake systems by reducing C7 idle state residency. The revert restores the original behavior where get_typical_interval() returns UINT_MAX when unable to make a high-confidence prediction, allowing the deepest available idle state to be selected. This is important for systems with aggressive power limits where deep idle states correlate with higher maximum CPU frequencies.
Key Changes
- Removed conditional logic that returned the current maximum value when there were sufficient data points remaining after outlier elimination
- Restored simple
UINT_MAXreturn when the number of remaining samples is too small (divisor * 4 <= INTERVALS * 3) - Added a comprehensive comment explaining the rationale for returning
UINT_MAXto guide future development
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * selected because there are systems where the time spent by CPUs in | ||
| * deep idle states is correlated to the maximum frequency the CPUs | ||
| * can get to. On those systems, shallow idle states should be avoided | ||
| * unless there is a clear indication that the given CPU is most likley |
Copilot
AI
Nov 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the comment: "likley" should be "likely".
| * unless there is a clear indication that the given CPU is most likley | |
| * unless there is a clear indication that the given CPU is most likely |
stable inclusion
from stable-v6.6.115
category: bugfix
commit 10fad4012234a7dea621ae17c0c9486824f645a0 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 [email protected]
Cc: All applicable [email protected]
Link: https://patch.msgid.link/[email protected]
(cherry picked from commit 29d96bcc1495260ada5aae073b8939d7afcecc16)
Summary by Sourcery
Revert the recent cpuidle menu change to restore the original idle-state prediction fallback and prevent performance regressions on systems like Jasper Lake
Bug Fixes:
Enhancements: