diff options
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 4acb904908d1..cb5607495816 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -884,7 +884,7 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu) | |||
884 | sample->core_pct_busy = (int32_t)core_pct; | 884 | sample->core_pct_busy = (int32_t)core_pct; |
885 | } | 885 | } |
886 | 886 | ||
887 | static inline void intel_pstate_sample(struct cpudata *cpu, u64 time) | 887 | static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time) |
888 | { | 888 | { |
889 | u64 aperf, mperf; | 889 | u64 aperf, mperf; |
890 | unsigned long flags; | 890 | unsigned long flags; |
@@ -894,9 +894,9 @@ static inline void intel_pstate_sample(struct cpudata *cpu, u64 time) | |||
894 | rdmsrl(MSR_IA32_APERF, aperf); | 894 | rdmsrl(MSR_IA32_APERF, aperf); |
895 | rdmsrl(MSR_IA32_MPERF, mperf); | 895 | rdmsrl(MSR_IA32_MPERF, mperf); |
896 | tsc = rdtsc(); | 896 | tsc = rdtsc(); |
897 | if ((cpu->prev_mperf == mperf) || (cpu->prev_tsc == tsc)) { | 897 | if (cpu->prev_mperf == mperf || cpu->prev_tsc == tsc) { |
898 | local_irq_restore(flags); | 898 | local_irq_restore(flags); |
899 | return; | 899 | return false; |
900 | } | 900 | } |
901 | local_irq_restore(flags); | 901 | local_irq_restore(flags); |
902 | 902 | ||
@@ -912,6 +912,7 @@ static inline void intel_pstate_sample(struct cpudata *cpu, u64 time) | |||
912 | cpu->prev_aperf = aperf; | 912 | cpu->prev_aperf = aperf; |
913 | cpu->prev_mperf = mperf; | 913 | cpu->prev_mperf = mperf; |
914 | cpu->prev_tsc = tsc; | 914 | cpu->prev_tsc = tsc; |
915 | return true; | ||
915 | } | 916 | } |
916 | 917 | ||
917 | static inline int32_t get_avg_frequency(struct cpudata *cpu) | 918 | static inline int32_t get_avg_frequency(struct cpudata *cpu) |
@@ -1025,8 +1026,9 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time, | |||
1025 | u64 delta_ns = time - cpu->sample.time; | 1026 | u64 delta_ns = time - cpu->sample.time; |
1026 | 1027 | ||
1027 | if ((s64)delta_ns >= pid_params.sample_rate_ns) { | 1028 | if ((s64)delta_ns >= pid_params.sample_rate_ns) { |
1028 | intel_pstate_sample(cpu, time); | 1029 | bool sample_taken = intel_pstate_sample(cpu, time); |
1029 | if (!hwp_active) | 1030 | |
1031 | if (sample_taken && !hwp_active) | ||
1030 | intel_pstate_adjust_busy_pstate(cpu); | 1032 | intel_pstate_adjust_busy_pstate(cpu); |
1031 | } | 1033 | } |
1032 | } | 1034 | } |