Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1475521
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC/RFT][PATCH 3/4] cpufreq: intel_pstate: Use average P-state in get_target_pstate_default() |
| Date | 2016-09-03 03:00 +0200 |
| Message-ID | <sd7tn-6DI-3@gated-at.bofh.it> (permalink) |
| References | <sd7tn-6DI-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Adjust the next P-state formula in get_target_pstate_default()
(in the filtered case) to use the average P-state as given by
the APERF and MPERF feedback registers instead of the exact
P-state requested previously, as that request might not be
granted.
Suggested-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -98,7 +98,6 @@ static inline u64 div_ext_fp(u64 x, u64
* @tsc: Difference of time stamp counter between last and
* current sample
* @time: Current time from scheduler
- * @target: Target P-state
*
* This structure is used in the cpudata structure to store performance sample
* data for choosing next P State.
@@ -110,7 +109,6 @@ struct sample {
u64 mperf;
u64 tsc;
u64 time;
- int target;
};
/**
@@ -1149,7 +1147,6 @@ static void intel_pstate_set_min_pstate(
trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
cpu->pstate.current_pstate = pstate;
- cpu->sample.target = pstate;
/*
* Generally, there is no guarantee that this code will always run on
* the CPU being updated, so force the register update to run on the
@@ -1305,8 +1302,8 @@ static inline int32_t get_target_pstate_
{
struct sample *sample = &cpu->sample;
int32_t busy_frac, boost;
- int pstate, max_perf, min_perf;
int64_t target;
+ int pstate;
pstate = limits->no_turbo || limits->turbo_disabled ?
cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
@@ -1341,17 +1338,20 @@ static inline int32_t get_target_pstate_
* Take the raw gain as 1/8 and compute the effective gain as
*
* iir_gain = 1/8 * delta_t / sampling_interval
+ *
+ * Moreover, since the output is a request that may or may not
+ * be granted (depending on what the other CPUs are doing, for
+ * example), instead of using the output value obtained
+ * previously in the computation, use the effective average
+ * P-state since the last pass as given by APERF and MPERF.
*/
iir_gain = div_fp(sample->time - cpu->last_sample_time,
pid_params.sample_rate_ns << 3);
if (iir_gain < int_tofp(1))
- target = sample->target * (int_tofp(1) - iir_gain) +
+ target = get_avg_pstate(cpu) * (int_tofp(1) - iir_gain) +
mul_fp(target, iir_gain);
}
- intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
- target = clamp_val(target, int_tofp(min_perf), int_tofp(max_perf));
- sample->target = fp_toint(target + (1 << (FRAC_BITS-1)));
- return sample->target;
+ return fp_toint(target + (1 << (FRAC_BITS-1)));
}
static inline void intel_pstate_update_pstate(struct cpudata *cpu, int pstate)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-03 03:00 +0200
[RFC/RFT][PATCH 3/4] cpufreq: intel_pstate: Use average P-state in get_target_pstate_default() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-03 03:00 +0200
[RFC/RFT][PATCH 1/4] cpufreq / sched: SCHED_CPUFREQ_IOWAIT flag to indicate iowait condition "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-03 03:00 +0200
[RFC/RFT][PATCH 4/4] cpufreq: schedutil: Add iowait boosting "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-03 03:00 +0200
[RFC/RFT][PATCH 2/4] cpufreq: intel_pstate: Change P-state selection algorithm for Core "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-03 03:10 +0200
RE: [RFC/RFT][PATCH 2/4] cpufreq: intel_pstate: Change P-state selection algorithm for Core "Doug Smythies" <dsmythies@telus.net> - 2016-09-07 17:30 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil Steve Muckle <steve.muckle@linaro.org> - 2016-09-08 02:30 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-08 02:40 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 02:40 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-08 02:50 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 03:20 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 17:00 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-08 19:40 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil Steve Muckle <steve.muckle@linaro.org> - 2016-09-08 21:30 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-09-08 21:50 +0200
Re: [RFC/RFT][PATCH 0/4] cpufreq / sched: iowait boost in intel_pstate and schedutil "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-08 02:40 +0200
csiph-web