Linux Power Management development
 help / color / mirror / Atom feed
From: Philippe Longepe <philippe.longepe@linux.intel.com>
To: linux-pm@vger.kernel.org
Cc: srinivas.pandruvada@linux.intel.com, rafael@kernel.org
Subject: [PATCH V6 2/4] intel_pstate: Optimize calculation for max/min_perf_adj
Date: Tue,  8 Mar 2016 10:31:16 +0100	[thread overview]
Message-ID: <1457429481-13283-5-git-send-email-philippe.longepe@linux.intel.com> (raw)
In-Reply-To: <1457429481-13283-1-git-send-email-philippe.longepe@linux.intel.com>

mul_fp(int_tofp(A), B) expands to:
((A << FRAC_BITS) * B) >> FRAC_BITS, so the same result can be obtained
via simple multiplication A * B.  Apply this observation to
max_perf * limits->max_perf and max_perf * limits->min_perf in
intel_pstate_get_min_max()."

Signed-off-by: Philippe Longepe <philippe.longepe@linux.intel.com>
---
 drivers/cpufreq/intel_pstate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 114e4e0..c46d23a 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -828,11 +828,11 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max)
 	 * policy, or by cpu specific default values determined through
 	 * experimentation.
 	 */
-	max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf), limits->max_perf));
+	max_perf_adj = fp_toint(max_perf * limits->max_perf);
 	*max = clamp_t(int, max_perf_adj,
 			cpu->pstate.min_pstate, cpu->pstate.turbo_pstate);
 
-	min_perf = fp_toint(mul_fp(int_tofp(max_perf), limits->min_perf));
+	min_perf = fp_toint(max_perf * limits->min_perf);
 	*min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
 }
 
-- 
1.9.1


  parent reply	other threads:[~2016-03-08  9:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08  9:31 [PATCH V6 0/4] Reduce the intel_pstate timer overhead Philippe Longepe
2016-03-08  9:31 ` Philippe Longepe
2016-03-08  9:31 ` [PATCH V6 1/4] intel_pstate: Remove extra conversions in pid calculation Philippe Longepe
2016-03-08  9:31 ` Philippe Longepe
2016-03-08  9:31 ` Philippe Longepe [this message]
2016-03-08  9:31 ` [PATCH V6 2/4] intel_pstate: Optimize calculation for max/min_perf_adj Philippe Longepe
2016-03-08  9:31 ` [PATCH V6 3/4] intel_pstate: Move the intel_pstate_calc_busy into get_target_pstate_use_performance Philippe Longepe
2016-03-08  9:31 ` Philippe Longepe
2016-03-08  9:31 ` [PATCH V6 4/4] intel_pstate: Remove the freq calculation from the intel_pstate_calc_busy function Philippe Longepe
2016-03-08  9:31 ` Philippe Longepe
2016-03-10 23:19 ` [PATCH V6 0/4] Reduce the intel_pstate timer overhead Rafael J. Wysocki

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=1457429481-13283-5-git-send-email-philippe.longepe@linux.intel.com \
    --to=philippe.longepe@linux.intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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