[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180705153249.GH32579@e108498-lin.cambridge.arm.com>
Date: Thu, 5 Jul 2018 16:32:49 +0100
From: Quentin Perret <quentin.perret@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: rjw@...ysocki.net, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, gregkh@...uxfoundation.org,
mingo@...hat.com, dietmar.eggemann@....com,
morten.rasmussen@....com, chris.redpath@....com,
patrick.bellasi@....com, valentin.schneider@....com,
vincent.guittot@...aro.org, thara.gopinath@...aro.org,
viresh.kumar@...aro.org, tkjos@...gle.com, joel@...lfernandes.org,
smuckle@...gle.com, adharmap@...cinc.com, skannan@...cinc.com,
pkondeti@...eaurora.org, juri.lelli@...hat.com,
edubezval@...il.com, srinivas.pandruvada@...ux.intel.com,
currojerez@...eup.net, javi.merino@...nel.org
Subject: Re: [RFC PATCH v4 03/12] PM: Introduce an Energy Model management
framework
On Thursday 05 Jul 2018 at 17:06:29 (+0200), Peter Zijlstra wrote:
> On Thu, Jun 28, 2018 at 12:40:34PM +0100, Quentin Perret wrote:
> > +/* fd_update_cs_table() - Computes the capacity values of a cs_table
> > + *
> > + * This assumes a linear relation between capacity and frequency. As such,
> > + * the capacity of a CPU at the n^th capacity state is computed as:
> > + * capactity(n) = max_capacity * freq(n) / freq_max
> > + */
>
> Broken comment style
>
> > +static void fd_update_cs_table(struct em_cs_table *cs_table, int cpu)
> > +{
> > + unsigned long cmax = arch_scale_cpu_capacity(NULL, cpu);
> > + int max_cap_state = cs_table->nr_cap_states - 1;
> > + unsigned long fmax = cs_table->state[max_cap_state].frequency;
> > + int i;
> > +
> > + for (i = 0; i < cs_table->nr_cap_states; i++) {
> > + u64 cap = (u64)cmax * cs_table->state[i].frequency;
> > + do_div(cap, fmax);
> > + cs_table->state[i].capacity = (unsigned long)cap;
>
> I prefer div64_*() over do_div(), the calling convention the latter
> always confuses the heck out of me.
>
> So this then becomes something like:
>
> cs_table->state[i].capacity =
> div64_u64(cmax * cs_table->state[i].frequency, fmax);
Ok, I'll change both.
Thanks,
Quentin
Powered by blists - more mailing lists