diff options
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 66f7f0071cab..b230ebaae66c 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -1070,8 +1070,9 @@ static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) | |||
1070 | 1070 | ||
1071 | static inline int32_t get_avg_frequency(struct cpudata *cpu) | 1071 | static inline int32_t get_avg_frequency(struct cpudata *cpu) |
1072 | { | 1072 | { |
1073 | return div64_u64(cpu->pstate.max_pstate_physical * cpu->sample.aperf * | 1073 | return fp_toint(mul_fp(cpu->sample.core_pct_busy, |
1074 | cpu->pstate.scaling, cpu->sample.mperf); | 1074 | int_tofp(cpu->pstate.max_pstate_physical * |
1075 | cpu->pstate.scaling / 100))); | ||
1075 | } | 1076 | } |
1076 | 1077 | ||
1077 | static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) | 1078 | static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) |
@@ -1114,8 +1115,6 @@ static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu) | |||
1114 | int32_t core_busy, max_pstate, current_pstate, sample_ratio; | 1115 | int32_t core_busy, max_pstate, current_pstate, sample_ratio; |
1115 | u64 duration_ns; | 1116 | u64 duration_ns; |
1116 | 1117 | ||
1117 | intel_pstate_calc_busy(cpu); | ||
1118 | |||
1119 | /* | 1118 | /* |
1120 | * core_busy is the ratio of actual performance to max | 1119 | * core_busy is the ratio of actual performance to max |
1121 | * max_pstate is the max non turbo pstate available | 1120 | * max_pstate is the max non turbo pstate available |
@@ -1199,8 +1198,11 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time, | |||
1199 | if ((s64)delta_ns >= pid_params.sample_rate_ns) { | 1198 | if ((s64)delta_ns >= pid_params.sample_rate_ns) { |
1200 | bool sample_taken = intel_pstate_sample(cpu, time); | 1199 | bool sample_taken = intel_pstate_sample(cpu, time); |
1201 | 1200 | ||
1202 | if (sample_taken && !hwp_active) | 1201 | if (sample_taken) { |
1203 | intel_pstate_adjust_busy_pstate(cpu); | 1202 | intel_pstate_calc_busy(cpu); |
1203 | if (!hwp_active) | ||
1204 | intel_pstate_adjust_busy_pstate(cpu); | ||
1205 | } | ||
1204 | } | 1206 | } |
1205 | } | 1207 | } |
1206 | 1208 | ||