Re: stable: commit "cpuidle: menu: Avoid discarding useful information" causes regressions
From: Rafael J. Wysocki
Date: Wed Oct 15 2025 - 09:08:22 EST
On Wed, Oct 15, 2025 at 3:56 AM Sergey Senozhatsky
<senozhatsky@xxxxxxxxxxxx> wrote:
>
> On (25/10/14 16:02), Rafael J. Wysocki wrote:
> > > >> Would it be possible to check if the mainline has this issue? That
> > > >> is, compare the benchmark results on unmodified 6.17 (say) and on 6.17
> > > >> with commit 85975daeaa4 reverted?
> > > >
> > > > I don't think mainline kernel can run on those devices (due to
> > > > a bunch of downstream patches). Best bet is 6.12, I guess.
> > >
> > > Depending on what Rafael is expecting here you might just get
> > > away with copying menu.c from mainline, the interactions to other
> > > subsystems are limited fortunately.
> >
> > Yeah, that'd be sufficiently close.
>
> Test results for menu.c from linux-next are within regressed range: 78.5
So please check if the attached patch makes any difference.
---
drivers/cpuidle/governors/menu.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -116,6 +116,7 @@ static void menu_update(struct cpuidle_d
static unsigned int get_typical_interval(struct menu_device *data)
{
s64 value, min_thresh = -1, max_thresh = UINT_MAX;
+ unsigned int max_overall = 0;
unsigned int max, min, divisor;
u64 avg, variance, avg_sq;
int i;
@@ -151,6 +152,9 @@ again:
if (!max)
return UINT_MAX;
+ if (max_overall < max)
+ max_overall = max;
+
if (divisor == INTERVALS) {
avg >>= INTERVAL_SHIFT;
variance >>= INTERVAL_SHIFT;
@@ -198,7 +202,7 @@ again:
* maximum, so return the latter in that case.
*/
if (divisor >= INTERVALS / 2)
- return max;
+ return max_overall;
return UINT_MAX;
}