From: Dirk Brandewie <dirk.brandewie@gmail.com>
To: Stratos Karafotis <stratosk@semaphore.gr>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>,
Dirk Brandewie <dirk.j.brandewie@intel.com>
Cc: dirk.brandewie@gmail.com,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/7] cpufreq: intel_pstate: Avoid duplicate call of intel_pstate_get_scaled_busy
Date: Tue, 10 Jun 2014 09:05:53 -0700 [thread overview]
Message-ID: <53972CE1.1060209@gmail.com> (raw)
In-Reply-To: <53962067.4060504@semaphore.gr>
On 06/09/2014 02:00 PM, Stratos Karafotis wrote:
> Store busy_scaled value to avoid to duplicate call of
> intel_pstate_get_scaled_busy on every sampling interval.
>
The second call *only* happens if the tracepoint is being used otherwise
the whole function call to trace_pstate_sample() is a noop.
This makes the code less readable IMHO the reader is left wondering
how cpu->sample.busy_scaled was set in intel_pstate_adjust_busy_pstate()
> Also, rename the function to intel_pstate_calc_scaled_busy.
>
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> ---
> drivers/cpufreq/intel_pstate.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 4e7f492..31e2ae5 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -55,6 +55,7 @@ static inline int32_t div_fp(int32_t x, int32_t y)
>
> struct sample {
> int32_t core_pct_busy;
> + int32_t busy_scaled;
> u64 aperf;
> u64 mperf;
> int freq;
> @@ -604,7 +605,7 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu)
> mod_timer_pinned(&cpu->timer, jiffies + delay);
> }
>
> -static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu)
> +static inline void intel_pstate_calc_scaled_busy(struct cpudata *cpu)
> {
> int32_t core_busy, max_pstate, current_pstate, sample_ratio;
> u32 duration_us;
> @@ -624,20 +625,19 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu)
> core_busy = mul_fp(core_busy, sample_ratio);
> }
>
> - return core_busy;
> + cpu->sample.busy_scaled = core_busy;
> }
>
> static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
> {
> - int32_t busy_scaled;
> struct _pid *pid;
> signed int ctl = 0;
> int steps;
>
> pid = &cpu->pid;
> - busy_scaled = intel_pstate_get_scaled_busy(cpu);
> + intel_pstate_calc_scaled_busy(cpu);
>
> - ctl = pid_calc(pid, busy_scaled);
> + ctl = pid_calc(pid, cpu->sample.busy_scaled);
>
> steps = abs(ctl);
>
> @@ -659,7 +659,7 @@ static void intel_pstate_timer_func(unsigned long __data)
> intel_pstate_adjust_busy_pstate(cpu);
>
> trace_pstate_sample(fp_toint(sample->core_pct_busy),
> - fp_toint(intel_pstate_get_scaled_busy(cpu)),
> + fp_toint(sample->busy_scaled),
> cpu->pstate.current_pstate,
> sample->mperf,
> sample->aperf,
>
next prev parent reply other threads:[~2014-06-10 16:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-09 21:00 [PATCH 2/7] cpufreq: intel_pstate: Avoid duplicate call of intel_pstate_get_scaled_busy Stratos Karafotis
2014-06-10 16:05 ` Dirk Brandewie [this message]
2014-06-10 16:26 ` Stratos Karafotis
2014-06-14 15:45 ` Doug Smythies
2014-06-14 15:45 ` Doug Smythies
2014-06-14 18:10 ` Stratos Karafotis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53972CE1.1060209@gmail.com \
--to=dirk.brandewie@gmail.com \
--cc=dirk.j.brandewie@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=stratosk@semaphore.gr \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.