Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1399377

[PATCH v2, 3/3] intel_pstate: Clean up get_target_pstate_use_performance()

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject [PATCH v2, 3/3] intel_pstate: Clean up get_target_pstate_use_performance()
Date 2016-05-11 19:20 +0200
Message-ID <rxFXI-49l-15@gated-at.bofh.it> (permalink)
References <rvXFn-6JF-9@gated-at.bofh.it> <rxFO1-42S-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The comments and the core_busy variable name in
get_target_pstate_use_performance() are totally confusing,
so modify them to reflect what's going on.

The results of the computations should be the same as before.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |   27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -1254,43 +1254,38 @@ static inline int32_t get_target_pstate_
 
 static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu)
 {
-	int32_t core_busy, max_pstate, current_pstate, sample_ratio;
+	int32_t perf_scaled, max_pstate, current_pstate, sample_ratio;
 	u64 duration_ns;
 
 	/*
-	 * core_busy is the ratio of actual performance to max
-	 * max_pstate is the max non turbo pstate available
-	 * current_pstate was the pstate that was requested during
-	 * 	the last sample period.
-	 *
-	 * We normalize core_busy, which was our actual percent
-	 * performance to what we requested during the last sample
-	 * period. The result will be a percentage of busy at a
-	 * specified pstate.
+	 * perf_scaled is the average performance during the last sampling
+	 * period scaled by the ratio of the maximum P-state to the P-state
+	 * requested last time (in percent).  That measures the system's
+	 * response to the previous P-state selection.
 	 */
 	max_pstate = cpu->pstate.max_pstate_physical;
 	current_pstate = cpu->pstate.current_pstate;
-	core_busy = mul_ext_fp(cpu->sample.core_avg_perf,
+	perf_scaled = mul_ext_fp(cpu->sample.core_avg_perf,
 			       div_fp(100 * max_pstate, current_pstate));
 
 	/*
 	 * Since our utilization update callback will not run unless we are
 	 * in C0, check if the actual elapsed time is significantly greater (3x)
 	 * than our sample interval.  If it is, then we were idle for a long
-	 * enough period of time to adjust our busyness.
+	 * enough period of time to adjust our performance metric.
 	 */
 	duration_ns = cpu->sample.time - cpu->last_sample_time;
 	if ((s64)duration_ns > pid_params.sample_rate_ns * 3) {
 		sample_ratio = div_fp(pid_params.sample_rate_ns, duration_ns);
-		core_busy = mul_fp(core_busy, sample_ratio);
+		perf_scaled = mul_fp(perf_scaled, sample_ratio);
 	} else {
 		sample_ratio = div_fp(100 * cpu->sample.mperf, cpu->sample.tsc);
 		if (sample_ratio < int_tofp(1))
-			core_busy = 0;
+			perf_scaled = 0;
 	}
 
-	cpu->sample.busy_scaled = core_busy;
-	return cpu->pstate.current_pstate - pid_calc(&cpu->pid, core_busy);
+	cpu->sample.busy_scaled = perf_scaled;
+	return cpu->pstate.current_pstate - pid_calc(&cpu->pid, perf_scaled);
 }
 
 static inline void intel_pstate_update_pstate(struct cpudata *cpu, int pstate)

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] intel_pstate: Improvements related to the APERF/MPERF computation "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-07 01:50 +0200
  [PATCH v2, 2/3] intel_pstate: Use sample.core_avg_perf in get_avg_pstate() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-11 19:10 +0200
  [PATCH v2, 1/3] intel_pstate: Clarify average performance computation "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-11 19:10 +0200
  [PATCH v2, 0/3] intel_pstate: Improvements related to the APERF/MPERF computation "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-11 19:10 +0200
    [PATCH v2, 3/3] intel_pstate: Clean up get_target_pstate_use_performance() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-11 19:20 +0200

csiph-web