Re: [GIT PULL] Scheduler changes for v6.8

From: Vincent Guittot
Date: Sat Jan 13 2024 - 05:47:45 EST


Le vendredi 12 janv. 2024 à 17:31:13 (-0800), Linus Torvalds a écrit :
> On Fri, 12 Jan 2024 at 17:24, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > With a *working* kernel, I get events, setting the frequency to either
> > 2.2GHz (idle) or 3.8GHz (work).
>
> Just to fix that - not 3.8Ghz, but in addition to 2.2 I see 2.8 or 3.7:

IIUC, with the commit you stay at lowest frequency all time which is clearly
weird. One change that could create such behavior is in
sugov_effective_cpu_perf() where we take the min between the actual
utilization and the max allowed. If max is set to min capacity for whatever
the reason, then you stay stuck to lowest capacity/frequency

What is the output of
/sys/devices/system/cpu/cpu0/cpu_capacity

It should be 1024 or close

Could you try the below ? it skips this step and ensures to use the actual
utilization to select the frequency

---
kernel/sched/cpufreq_schedutil.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 95c3c097083e..e420e2ee1a10 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -181,7 +181,6 @@ unsigned long sugov_effective_cpu_perf(int cpu, unsigned long actual,
/* Add dvfs headroom to actual utilization */
actual = map_util_perf(actual);
/* Actually we don't need to target the max performance */
- if (actual < max)
max = actual;

/*
--
2.34.1

>
> ...
> <idle>-0 [034] d.s.. 208.340412: cpu_frequency:
> state=2200000 cpu_id=34
> cc1-101686 [034] d.h.. 208.342402: cpu_frequency:
> state=2800000 cpu_id=34
> cc1-101686 [034] d.h.. 208.343401: cpu_frequency:
> state=3700000 cpu_id=34
> sh-108794 [029] d.h.. 216.401014: cpu_frequency:
> state=2200000 cpu_id=29
> sh-108794 [029] d.... 216.402670: cpu_frequency:
> state=2800000 cpu_id=29
> genksyms-108565 [029] d.h.. 216.404005: cpu_frequency:
> state=3700000 cpu_id=29
> ...
>
> etc.
>
> Linus