aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Longepe <philippe.longepe@linux.intel.com>2016-03-06 02:34:06 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-10 18:04:58 -0500
commit8fa520af50817d5f30d293f507c937f561b3e6b9 (patch)
tree8b6bf612d99d0b3ab9b8da0dae478b7bddd63cfc
parent7349ec0470b62820ae226e30770b9d84a53ced9d (diff)
intel_pstate: Remove freq calculation from intel_pstate_calc_busy()
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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/intel_pstate.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 95cc21713bb4..4acb904908d1 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -881,12 +881,6 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu)
881 core_pct = int_tofp(sample->aperf) * int_tofp(100); 881 core_pct = int_tofp(sample->aperf) * int_tofp(100);
882 core_pct = div64_u64(core_pct, int_tofp(sample->mperf)); 882 core_pct = div64_u64(core_pct, int_tofp(sample->mperf));
883 883
884 sample->freq = fp_toint(
885 mul_fp(int_tofp(
886 cpu->pstate.max_pstate_physical *
887 cpu->pstate.scaling / 100),
888 core_pct));
889
890 sample->core_pct_busy = (int32_t)core_pct; 884 sample->core_pct_busy = (int32_t)core_pct;
891} 885}
892 886
@@ -920,6 +914,12 @@ static inline void intel_pstate_sample(struct cpudata *cpu, u64 time)
920 cpu->prev_tsc = tsc; 914 cpu->prev_tsc = tsc;
921} 915}
922 916
917static inline int32_t get_avg_frequency(struct cpudata *cpu)
918{
919 return div64_u64(cpu->pstate.max_pstate_physical * cpu->sample.aperf *
920 cpu->pstate.scaling, cpu->sample.mperf);
921}
922
923static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) 923static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
924{ 924{
925 struct sample *sample = &cpu->sample; 925 struct sample *sample = &cpu->sample;
@@ -1015,7 +1015,7 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
1015 sample->mperf, 1015 sample->mperf,
1016 sample->aperf, 1016 sample->aperf,
1017 sample->tsc, 1017 sample->tsc,
1018 sample->freq); 1018 get_avg_frequency(cpu));
1019} 1019}
1020 1020
1021static void intel_pstate_update_util(struct update_util_data *data, u64 time, 1021static void intel_pstate_update_util(struct update_util_data *data, u64 time,
@@ -1104,7 +1104,7 @@ static unsigned int intel_pstate_get(unsigned int cpu_num)
1104 if (!cpu) 1104 if (!cpu)
1105 return 0; 1105 return 0;
1106 sample = &cpu->sample; 1106 sample = &cpu->sample;
1107 return sample->freq; 1107 return get_avg_frequency(cpu);
1108} 1108}
1109 1109
1110static int intel_pstate_set_policy(struct cpufreq_policy *policy) 1110static int intel_pstate_set_policy(struct cpufreq_policy *policy)