Re: [PATCH v9 6/7] sched/fair: Remove task_util from effective utilization in feec()

From: Vincent Donnefort
Date: Mon Jun 06 2022 - 05:32:33 EST


On Tue, May 31, 2022 at 10:17:01AM +0200, Dietmar Eggemann wrote:
> - Vincent Donnefort <vincent.donnefort@xxxxxxx>
>
> On 23/05/2022 17:51, Vincent Donnefort wrote:
> > From: Vincent Donnefort <vincent.donnefort@xxxxxxx>
>
> [...]
>
> > @@ -6834,22 +6887,36 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
> > if (!task_util_est(p))
> > goto unlock;
> >
> > + eenv_task_busy_time(&eenv, p, prev_cpu);
> > +
> > for (; pd; pd = pd->next) {
> > - unsigned long cur_delta, spare_cap, max_spare_cap = 0;
> > + unsigned long cpu_cap, cpu_thermal_cap, util;
> > + unsigned long cur_delta, max_spare_cap = 0;
> > bool compute_prev_delta = false;
> > unsigned long base_energy_pd;
> > int max_spare_cap_cpu = -1;
> >
> > cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask);
>
> Internal EAS testing of this patch-set version has revealed that this
> doesn't work against LTP CPU hotplug stress test. `struct cpumask *cpus`
> can't be used when it is empty. This can happen in case all PD CPUs are
> hotplugged out since we `and` the invariant PD cpumask with
> cpu_online_mask. We need a:
>
> + if (cpumask_empty(cpus))
> + continue;
> +
>
> here.

Good catch, thanks for trying the test suite.

>
> > - for_each_cpu_and(cpu, cpus, sched_domain_span(sd)) {
> > + /* Account thermal pressure for the energy estimation */
> > + cpu = cpumask_first(cpus);
> > + cpu_thermal_cap = arch_scale_cpu_capacity(cpu);
> > + cpu_thermal_cap -= arch_scale_thermal_pressure(cpu);
>
> [...]