| @@ -42,6 +42,10 @@ static void aperfmperf_snapshot_khz(void *dummy) · 41 unmodified lines |
| 42 | s64 time_delta = ktime_ms_delta(now, s->time); | 42 | s64 time_delta = ktime_ms_delta(now, s->time); |
| 43 | unsigned long flags; | 43 | unsigned long flags; |
| 44 | | 44 | |
| | 45 | /* Don't bother re-computing within the cache threshold time. */ |
| | 46 | if (time_delta < APERFMPERF_CACHE_THRESHOLD_MS) |
| | 47 | return; |
| | 48 | |
| 45 | local_irq_save(flags); | 49 | local_irq_save(flags); |
| 46 | rdmsrl(MSR_IA32_APERF, aperf); | 50 | rdmsrl(MSR_IA32_APERF, aperf); |
| 47 | rdmsrl(MSR_IA32_MPERF, mperf); | 51 | rdmsrl(MSR_IA32_MPERF, mperf); |
| @@ -70,7 +74,6 @@ static void aperfmperf_snapshot_khz(void *dummy) · 22 unmodified lines |
| 70 | | 74 | |
| 71 | unsigned int arch_freq_get_on_cpu(int cpu) | 75 | unsigned int arch_freq_get_on_cpu(int cpu) |
| 72 | { | 76 | { |
| 73 | s64 time_delta; | | |
| 74 | unsigned int khz; | 77 | unsigned int khz; |
| 75 | | 78 | |
| 76 | if (!cpu_khz) | 79 | if (!cpu_khz) |
| @@ -79,12 +82,6 @@ unsigned int arch_freq_get_on_cpu(int cpu) · 2 unmodified lines |
| 79 | if (!static_cpu_has(X86_FEATURE_APERFMPERF)) | 82 | if (!static_cpu_has(X86_FEATURE_APERFMPERF)) |
| 80 | return 0; | 83 | return 0; |
| 81 | | 84 | |
| 82 | /* Don't bother re-computing within the cache threshold time. */ | | |
| 83 | time_delta = ktime_ms_delta(ktime_get(), per_cpu(samples.time, cpu)); | | |
| 84 | khz = per_cpu(samples.khz, cpu); | | |
| 85 | if (khz && time_delta < APERFMPERF_CACHE_THRESHOLD_MS) | | |
| 86 | return khz; | | |
| 87 | | | |
| 88 | smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1); | 85 | smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1); |
| 89 | khz = per_cpu(samples.khz, cpu); | 86 | khz = per_cpu(samples.khz, cpu); |
| 90 | if (khz) | 87 | if (khz) |