On Thu, Jun 28, 2018 at 12:40:40PM +0100, Quentin Perret wrote:
> +static long 
   compute_energy(struct task_struct *p, int dst_cpu, struct freq_domain *fd)
> +{
> +     long util, max_util, sum_util, energy = 0;
> +     int cpu;
> +
> +     while (fd) {
> +             max_util = sum_util = 0;
> +             for_each_cpu_and(cpu, freq_domain_span(fd), cpu_online_mask) {

I had a wee little wtf moment when I realized this crosses root_domain
boundaries but that that is actually desired. A comment might be in
order.

> +                     util = cpu_util_next(cpu, p, dst_cpu);
> +                     util += cpu_util_dl(cpu_rq(cpu));
> +                     /* XXX: add RT util_avg when available. */
> +
> +                     max_util = max(util, max_util);
> +                     sum_util += util;

Did you want to use sugov_get_util() here? There is no way we're going
to duplicate all that.

ISTR we already established the whole EAS was going to require using
schedutil anyway.

> +             }
> +
> +             energy += em_fd_energy(fd->obj, max_util, sum_util);
> +             fd = fd->next;
> +     }
> +
> +     return energy;
> +}

Reply via email to