diff options
author | Dirk Brandewie <dirk.j.brandewie@intel.com> | 2014-02-12 13:01:04 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-03-01 18:33:46 -0500 |
commit | d37e2b764499e092ebc493d6f980827feb952e23 (patch) | |
tree | c45851285e1c7a4cdca583d084408231eecaa51c | |
parent | bd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4 (diff) |
intel_pstate: remove unneeded sample buffers
Remove unneeded sample buffers, intel_pstate operates on the most
recent sample only. This save some memory and make the code more
readable.
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 2cd36b9297f3..41f9eb295f0c 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -99,8 +99,7 @@ struct cpudata { | |||
99 | u64 prev_aperf; | 99 | u64 prev_aperf; |
100 | u64 prev_mperf; | 100 | u64 prev_mperf; |
101 | unsigned long long prev_tsc; | 101 | unsigned long long prev_tsc; |
102 | int sample_ptr; | 102 | struct sample sample; |
103 | struct sample samples[SAMPLE_COUNT]; | ||
104 | }; | 103 | }; |
105 | 104 | ||
106 | static struct cpudata **all_cpu_data; | 105 | static struct cpudata **all_cpu_data; |
@@ -586,15 +585,14 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
586 | mperf = mperf >> FRAC_BITS; | 585 | mperf = mperf >> FRAC_BITS; |
587 | tsc = tsc >> FRAC_BITS; | 586 | tsc = tsc >> FRAC_BITS; |
588 | 587 | ||
589 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | 588 | cpu->sample.aperf = aperf; |
590 | cpu->samples[cpu->sample_ptr].aperf = aperf; | 589 | cpu->sample.mperf = mperf; |
591 | cpu->samples[cpu->sample_ptr].mperf = mperf; | 590 | cpu->sample.tsc = tsc; |
592 | cpu->samples[cpu->sample_ptr].tsc = tsc; | 591 | cpu->sample.aperf -= cpu->prev_aperf; |
593 | cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; | 592 | cpu->sample.mperf -= cpu->prev_mperf; |
594 | cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; | 593 | cpu->sample.tsc -= cpu->prev_tsc; |
595 | cpu->samples[cpu->sample_ptr].tsc -= cpu->prev_tsc; | ||
596 | 594 | ||
597 | intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); | 595 | intel_pstate_calc_busy(cpu, &cpu->sample); |
598 | 596 | ||
599 | cpu->prev_aperf = aperf; | 597 | cpu->prev_aperf = aperf; |
600 | cpu->prev_mperf = mperf; | 598 | cpu->prev_mperf = mperf; |
@@ -614,7 +612,7 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | |||
614 | { | 612 | { |
615 | int32_t core_busy, max_pstate, current_pstate; | 613 | int32_t core_busy, max_pstate, current_pstate; |
616 | 614 | ||
617 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; | 615 | core_busy = cpu->sample.core_pct_busy; |
618 | max_pstate = int_tofp(cpu->pstate.max_pstate); | 616 | max_pstate = int_tofp(cpu->pstate.max_pstate); |
619 | current_pstate = int_tofp(cpu->pstate.current_pstate); | 617 | current_pstate = int_tofp(cpu->pstate.current_pstate); |
620 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); | 618 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); |
@@ -648,7 +646,7 @@ static void intel_pstate_timer_func(unsigned long __data) | |||
648 | 646 | ||
649 | intel_pstate_sample(cpu); | 647 | intel_pstate_sample(cpu); |
650 | 648 | ||
651 | sample = &cpu->samples[cpu->sample_ptr]; | 649 | sample = &cpu->sample; |
652 | 650 | ||
653 | intel_pstate_adjust_busy_pstate(cpu); | 651 | intel_pstate_adjust_busy_pstate(cpu); |
654 | 652 | ||
@@ -729,7 +727,7 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) | |||
729 | cpu = all_cpu_data[cpu_num]; | 727 | cpu = all_cpu_data[cpu_num]; |
730 | if (!cpu) | 728 | if (!cpu) |
731 | return 0; | 729 | return 0; |
732 | sample = &cpu->samples[cpu->sample_ptr]; | 730 | sample = &cpu->sample; |
733 | return sample->freq; | 731 | return sample->freq; |
734 | } | 732 | } |
735 | 733 | ||