diff options
| author | Viresh Kumar <viresh.kumar@linaro.org> | 2017-03-02 03:33:20 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-03-05 17:58:48 -0500 |
| commit | 6c4f0fa643cb9e775dcc976e3db00d649468ff1d (patch) | |
| tree | 4d044ebcfc34c31b7a0ff2e0c5ca49b7824c2e7b /kernel | |
| parent | c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201 (diff) | |
cpufreq: schedutil: move cached_raw_freq to struct sugov_policy
cached_raw_freq applies to the entire cpufreq policy and not individual
CPUs. Apart from wasting per-cpu memory, it is actually wrong to keep it
in struct sugov_cpu as we may end up comparing next_freq with a stale
cached_raw_freq of a random CPU.
Move cached_raw_freq to struct sugov_policy.
Fixes: 5cbea46984d6 (cpufreq: schedutil: map raw required frequency to driver frequency)
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/cpufreq_schedutil.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 8f8de3d4d6b7..3ab2aeaec6ec 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c | |||
| @@ -36,6 +36,7 @@ struct sugov_policy { | |||
| 36 | u64 last_freq_update_time; | 36 | u64 last_freq_update_time; |
| 37 | s64 freq_update_delay_ns; | 37 | s64 freq_update_delay_ns; |
| 38 | unsigned int next_freq; | 38 | unsigned int next_freq; |
| 39 | unsigned int cached_raw_freq; | ||
| 39 | 40 | ||
| 40 | /* The next fields are only needed if fast switch cannot be used. */ | 41 | /* The next fields are only needed if fast switch cannot be used. */ |
| 41 | struct irq_work irq_work; | 42 | struct irq_work irq_work; |
| @@ -52,7 +53,6 @@ struct sugov_cpu { | |||
| 52 | struct update_util_data update_util; | 53 | struct update_util_data update_util; |
| 53 | struct sugov_policy *sg_policy; | 54 | struct sugov_policy *sg_policy; |
| 54 | 55 | ||
| 55 | unsigned int cached_raw_freq; | ||
| 56 | unsigned long iowait_boost; | 56 | unsigned long iowait_boost; |
| 57 | unsigned long iowait_boost_max; | 57 | unsigned long iowait_boost_max; |
| 58 | u64 last_update; | 58 | u64 last_update; |
| @@ -146,9 +146,9 @@ static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util, | |||
| 146 | 146 | ||
| 147 | freq = (freq + (freq >> 2)) * util / max; | 147 | freq = (freq + (freq >> 2)) * util / max; |
| 148 | 148 | ||
| 149 | if (freq == sg_cpu->cached_raw_freq && sg_policy->next_freq != UINT_MAX) | 149 | if (freq == sg_policy->cached_raw_freq && sg_policy->next_freq != UINT_MAX) |
| 150 | return sg_policy->next_freq; | 150 | return sg_policy->next_freq; |
| 151 | sg_cpu->cached_raw_freq = freq; | 151 | sg_policy->cached_raw_freq = freq; |
| 152 | return cpufreq_driver_resolve_freq(policy, freq); | 152 | return cpufreq_driver_resolve_freq(policy, freq); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -580,6 +580,7 @@ static int sugov_start(struct cpufreq_policy *policy) | |||
| 580 | sg_policy->next_freq = UINT_MAX; | 580 | sg_policy->next_freq = UINT_MAX; |
| 581 | sg_policy->work_in_progress = false; | 581 | sg_policy->work_in_progress = false; |
| 582 | sg_policy->need_freq_update = false; | 582 | sg_policy->need_freq_update = false; |
| 583 | sg_policy->cached_raw_freq = 0; | ||
| 583 | 584 | ||
| 584 | for_each_cpu(cpu, policy->cpus) { | 585 | for_each_cpu(cpu, policy->cpus) { |
| 585 | struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); | 586 | struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); |
| @@ -590,7 +591,6 @@ static int sugov_start(struct cpufreq_policy *policy) | |||
| 590 | sg_cpu->max = 0; | 591 | sg_cpu->max = 0; |
| 591 | sg_cpu->flags = SCHED_CPUFREQ_RT; | 592 | sg_cpu->flags = SCHED_CPUFREQ_RT; |
| 592 | sg_cpu->last_update = 0; | 593 | sg_cpu->last_update = 0; |
| 593 | sg_cpu->cached_raw_freq = 0; | ||
| 594 | sg_cpu->iowait_boost = 0; | 594 | sg_cpu->iowait_boost = 0; |
| 595 | sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; | 595 | sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; |
| 596 | cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util, | 596 | cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util, |
