Re: [PATCH v2 4/4] sched/fair: Make feec() consider uclamp restrictions
From: Valentin Schneider
Date: Tue Dec 10 2019 - 13:35:58 EST
On 10/12/2019 18:23, Dietmar Eggemann wrote:
> 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.
I've changed the setup example to:
The target runqueue, rq:
rq.cpu_capacity_orig = 512
rq.cfs.avg.util_avg = 200
rq.uclamp.max = 768 // the max p.uclamp.max of all enqueued p's is 768
The waking task, p (not yet enqueued on rq):
p.util_est = 600
p.uclamp.max = 100
I'll also flesh out the rest.
>> 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.
That's what I imply with compute_energy() (which ends up calling