[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180705143151.GN2458@hirez.programming.kicks-ass.net>
Date: Thu, 5 Jul 2018 16:31:51 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Quentin Perret <quentin.perret@....com>
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 Thu, Jun 28, 2018 at 12:40:34PM +0100, Quentin Perret wrote:
> +/**
> + * em_fd_energy() - Estimates the energy consumed by the CPUs of a freq. domain
> + * @fd : frequency domain for which energy has to be estimated
> + * @max_util : highest utilization among CPUs of the domain
> + * @sum_util : sum of the utilization of all CPUs in the domain
> + *
> + * em_fd_energy() dereferences the capacity state table of the frequency
> + * domain, so it must be called under RCU read lock.
> + *
> + * Return: the sum of the energy consumed by the CPUs of the domain assuming
> + * a capacity state satisfying the max utilization of the domain.
> + */
> +static inline unsigned long em_fd_energy(struct em_freq_domain *fd,
> + unsigned long max_util, unsigned long sum_util)
> +{
> + struct em_cs_table *cs_table;
> + struct em_cap_state *cs;
> + unsigned long freq;
> + int i;
> +
> + cs_table = rcu_dereference(fd->cs_table);
> + if (!cs_table)
> + return 0;
> +
> + /* Map the utilization value to a frequency */
> + cs = &cs_table->state[cs_table->nr_cap_states - 1];
> + freq = map_util_freq(max_util, cs->frequency, cs->capacity);
> +
> + /* Find the lowest capacity state above this frequency */
> + for (i = 0; i < cs_table->nr_cap_states; i++) {
> + cs = &cs_table->state[i];
> + if (cs->frequency >= freq)
> + break;
> + }
> +
> + return cs->power * sum_util / cs->capacity;
> +}
I keep reading @max_util as the highest possible util (iow capacity) of
the freq domain, instead of the current highest instant capacity across
the CPUs in the domain.
At the same time I'm struggling for a better name. Maybe just @util? But
that would then maybe confuse against @sum_util. argh..
And I'm confused by what exactly this function computes; are you
(through sum_util) effectively setting idle power at 0?
Powered by blists - more mailing lists