Re: [PATCH V3 1/2] sched/core: Rename and move schedutil_cpu_util() to core.c
From: Rafael J. Wysocki
Date: Mon Nov 23 2020 - 05:29:41 EST
On Mon, Nov 23, 2020 at 11:05 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> On 19-11-20, 13:30, Rafael J. Wysocki wrote:
> > On Thu, Nov 19, 2020 at 8:38 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> > >
> > > There is nothing schedutil specific in schedutil_cpu_util(), move it to
> > > core.c and rename it to sched_cpu_util(), so it can be used from other
> > > parts of the kernel as well.
> >
> > The patch does more than this, though.
> >
> > I would do that in two patches: (1) move the function as is and (2)
> > rename it and rearrange the users.
>
> Sure.
>
> > > static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu)
> > > {
> > > - struct rq *rq = cpu_rq(sg_cpu->cpu);
> > > - unsigned long util = cpu_util_cfs(rq);
> > > - unsigned long max = arch_scale_cpu_capacity(sg_cpu->cpu);
> > > -
> > > - sg_cpu->max = max;
> > > - sg_cpu->bw_dl = cpu_bw_dl(rq);
> > > + sg_cpu->max = arch_scale_cpu_capacity(sg_cpu->cpu);
> > > + sg_cpu->bw_dl = cpu_bw_dl(cpu_rq(sg_cpu->cpu));
> > >
> > > - return schedutil_cpu_util(sg_cpu->cpu, util, max, FREQUENCY_UTIL, NULL);
> > > + return sched_cpu_util(sg_cpu->cpu, FREQUENCY_UTIL, sg_cpu->max);
> >
> > I don't see much value in using this wrapper here TBH and it
> > introduces an otherwise redundant cpu_rq() computation.
>
> You want to call effective_cpu_util() here instead, right ?
Right.