Messages in this thread | | | Date | Mon, 21 Aug 2023 18:39:35 +0200 | Subject | Re: [PATCH 2/4] sched: cpufreq: Fix apply_dvfs_headroom() escaping uclamp constraints | From | Dietmar Eggemann <> |
| |
On 20/08/2023 23:06, Qais Yousef wrote: > DVFS headroom is applied after we calculate the effective_cpu_util() > which is where we honour uclamp constraints. It makes more sense to > apply the headroom there once and let all users naturally get the right > thing without having to sprinkle the call around in various places.
uclamp is applied in effective_cpu_util(..., FREQUENCY_UTIL, ...) which IMHO currently has 2 power callers: (1) schedutil: sugov_get_util() and (2) EAS: eenv_pd_max_util()
> Before this fix running > > uclampset -M 800 cat /dev/zero > /dev/null > > Will cause the test system to run at max freq of 2.8GHz. After the fix > it runs at 2.2GHz instead which is the correct value that matches the > capacity of 800.
IMHO, a system at util = 800 (w/o uclamp) would also run at 2.8Ghz since we would call map_util_to_perf() on 800, no matter from where we call it.
> Note that similar problem exist for uclamp_min. If util was 50, and > uclamp_min is 100. Since we apply_dvfs_headroom() after apply uclamp > constraints, we'll end up with util of 125 instead of 100. IOW, we get > boosted twice, first time by uclamp_min, and second time by dvfs > headroom.
I see what you want to change here but:
So far we have `util -> uclamp -> map_util_to_perf()`
which is fine when we see uclamp as an entity which constrains util, not the util after being mapped to a capacity constraint.
[...]
| |