Re: [PATCH v2 4/4] sched/fair: Make feec() consider uclamp restrictions

From: Dietmar Eggemann
Date: Tue Dec 10 2019 - 13:23:44 EST


On 03/12/2019 16:59, Valentin Schneider wrote:

Could you replace feec (find_energy_efficient_cpu) with EAS wakeup path
in the subject line? The term EAS is described in
Documentation/scheduler/sched-energy.rst so its probably easier to match
the patch to functionality.

> We've just made task_fits_capacity() uclamp-aware, and
> find_energy_efficient_cpu() needs to go through the same treatment.
> Things are somewhat different here however - we can't directly use
> the now uclamp-aware task_fits_capacity(). Consider the following setup:
>
> rq.cpu_capacity_orig = 512
> rq.util_avg = 200
> rq.uclamp.max = 768
>
> p.util_est = 600
> p.uclamp.max = 256
>
> (p not yet enqueued on rq)
>
> Using task_fits_capacity() here would tell us that p fits on the above CPU.
> However, enqueuing p on that CPU *will* cause it to become overutilized
> since rq clamp values are max-aggregated, so we'd remain with

I assume it doesn't harm to explicitly mention that this rq.uclamp.max =
768 value comes from another task already enqueued on a cfs_rq of this
rq. This gives same substance to the term max-aggregated here.

> rq.uclamp.max = 768
>
> Thus we could reach a high enough frequency to reach beyond 0.8 * 512
> utilization (== overutilized). What feec() needs here is

s/feec()/find_energy_efficient_cpu() ?

> uclamp_rq_util_with() which lets us peek at the future utilization
> landscape, including rq-wide uclamp values.
>
> Make find_energy_efficient_cpu() use uclamp_rq_util_with() for its
> fits_capacity() check. This is in line with what compute_energy() ends up
> using for estimating utilization.

This is also aligned with schedutil_cpu_util() (you do mention this in
the code later in this patch.

[...]