linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Philippe Longepe <philippe.longepe@linux.intel.com>,
	linux-pm@vger.kernel.org
Cc: rafael@kernel.org
Subject: Re: [PATCH V5 4/4] intel_pstate: Remove the freq calculation from the intel_pstate_calc_busy function
Date: Mon, 07 Mar 2016 13:42:04 -0800	[thread overview]
Message-ID: <1457386924.4361.10.camel@linux.intel.com> (raw)
In-Reply-To: <1457249646-23072-5-git-send-email-philippe.longepe@linux.intel.com>

On Sun, 2016-03-06 at 08:34 +0100, Philippe Longepe wrote:
> Use a helper function to compute the average pstate and call it only
> where it is needed (only when tracing or in intel_pstate_get).
> 
> Signed-off-by: Philippe Longepe <philippe.longepe@linux.intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
>  drivers/cpufreq/intel_pstate.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c
> b/drivers/cpufreq/intel_pstate.c
> index 903341f..6e07366 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -878,12 +878,6 @@ static inline void intel_pstate_calc_busy(struct
> cpudata *cpu)
>  	core_pct = int_tofp(sample->aperf) * int_tofp(100);
>  	core_pct = div64_u64(core_pct, int_tofp(sample->mperf));
>  
> -	sample->freq = fp_toint(
> -		mul_fp(int_tofp(
> -			cpu->pstate.max_pstate_physical *
> -			cpu->pstate.scaling / 100),
> -			core_pct));
> -
>  	sample->core_pct_busy = (int32_t)core_pct;
>  }
>  
> @@ -917,6 +911,12 @@ static inline void intel_pstate_sample(struct
> cpudata *cpu, u64 time)
>  	cpu->prev_tsc = tsc;
>  }
>  
> +static inline int32_t get_avg_frequency(struct cpudata *cpu)
> +{
> +	return div64_u64(cpu->pstate.max_pstate_physical * cpu-
> >sample.aperf *
> +		cpu->pstate.scaling, cpu->sample.mperf);
> +}
> +
>  static inline int32_t get_target_pstate_use_cpu_load(struct cpudata
> *cpu)
>  {
>  	struct sample *sample = &cpu->sample;
> @@ -1012,7 +1012,7 @@ static inline void
> intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
>  		sample->mperf,
>  		sample->aperf,
>  		sample->tsc,
> -		sample->freq);
> +		get_avg_frequency(cpu));
>  }
>  
>  static void intel_pstate_update_util(struct update_util_data *data,
> u64 time,
> @@ -1101,7 +1101,7 @@ static unsigned int intel_pstate_get(unsigned
> int cpu_num)
>  	if (!cpu)
>  		return 0;
>  	sample = &cpu->sample;
> -	return sample->freq;
> +	return get_avg_frequency(cpu);
>  }
>  
>  static int intel_pstate_set_policy(struct cpufreq_policy *policy)

      reply	other threads:[~2016-03-07 21:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06  7:34 [PATCH V5 0/4] Reduce the intel_pstate timer overhead Philippe Longepe
2016-03-06  7:34 ` [PATCH V5 1/4] Remove extra conversions in pid calculation Philippe Longepe
2016-03-07 21:30   ` Srinivas Pandruvada
2016-03-06  7:34 ` [PATCH V5 2/4] Optimize calculation for max/min_perf_adj Philippe Longepe
2016-03-07 21:35   ` Srinivas Pandruvada
2016-03-06  7:34 ` [PATCH V5 3/4] Move the intel_pstate_calc_busy into get_target_pstate_use_performance Philippe Longepe
2016-03-07 21:36   ` Srinivas Pandruvada
2016-03-06  7:34 ` [PATCH V5 4/4] intel_pstate: Remove the freq calculation from the intel_pstate_calc_busy function Philippe Longepe
2016-03-07 21:42   ` Srinivas Pandruvada [this message]

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=1457386924.4361.10.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=philippe.longepe@linux.intel.com \
    --cc=rafael@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).