Re: [RFC PATCH v3 0/6] sched/cpufreq: Make schedutil energy aware

From: Peter Zijlstra
Date: Fri Oct 18 2019 - 04:12:06 EST


On Fri, Oct 18, 2019 at 09:44:44AM +0200, Dietmar Eggemann wrote:
> On 17/10/2019 16:11, Peter Zijlstra wrote:
> > On Thu, Oct 17, 2019 at 12:11:16PM +0100, Quentin Perret wrote:
>
> [...]
>
> > It only boosts when 'rq->cfs.avg.util' increases while
> > 'rq->cfs.avg.util_est.enqueued' remains unchanged (and util > util_est
> > obv).
> >
> > This condition can be true for select_task_rq_fair(), because that is
> > ran before we do enqueue_task_fair() (for obvious raisins).
> >
> >>> I'm still thinking about the exact means you're using to raise C; that
> >>> is, the 'util - util_est' as cost_margin. It hurts my brain still.
> >>
> >> +1 ...
> >
> > cost_i = capacity_i / power_i ; for the i-th OPP
>
> I get confused by this definition. efficiency=capacity/power but the
> cs->cost value used in em_pd_get_higher_freq() is defined as
>
> cs_cost = cs->power * cpu_max_freq / cs->freq [energy_model.h]

cost_i = power_i * f_max / f_i

cost(x) = cost_j * (1 + x) ; f_j >= min_freq

cost_k <= cost(x)

P = C*V^2*f, V ~ f -> P ~ f^3

cost_i ~ f_i^3 * f_max / f_i
= f_i^2 * f_max

cost(x) = (1 + x) * f_j^2 * f_max

cost_k = cost(x)

f_k^2 * f_max = (1 + x) * f_j^2 * f_max

f_k = sqrt(1 + x) * f_j

Which does indeed make more sense... However, I still struggle with
using our 'x = util - util_est' as input for an OPP specific increase.