diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-05-09 05:44:56 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-05-09 06:21:17 -0400 |
commit | 97739501f207efe33145b918817f305b822987f8 (patch) | |
tree | 2e3c2eba722910280f6f50ffbd445595c08e3d69 /kernel/sched | |
parent | a744490f12707d9f0b205272b29adf5bdb3ba193 (diff) |
cpufreq: schedutil: Avoid using invalid next_freq
If the next_freq field of struct sugov_policy is set to UINT_MAX,
it shouldn't be used for updating the CPU frequency (this is a
special "invalid" value), but after commit b7eaf1aab9f8 (cpufreq:
schedutil: Avoid reducing frequency of busy CPUs prematurely) it
may be passed as the new frequency to sugov_update_commit() in
sugov_update_single().
Fix that by adding an extra check for the special UINT_MAX value
of next_freq to sugov_update_single().
Fixes: b7eaf1aab9f8 (cpufreq: schedutil: Avoid reducing frequency of busy CPUs prematurely)
Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.12+ <stable@vger.kernel.org> # 4.12+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/cpufreq_schedutil.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 23ef19070137..e13df951aca7 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c | |||
@@ -305,7 +305,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, | |||
305 | * Do not reduce the frequency if the CPU has not been idle | 305 | * Do not reduce the frequency if the CPU has not been idle |
306 | * recently, as the reduction is likely to be premature then. | 306 | * recently, as the reduction is likely to be premature then. |
307 | */ | 307 | */ |
308 | if (busy && next_f < sg_policy->next_freq) { | 308 | if (busy && next_f < sg_policy->next_freq && |
309 | sg_policy->next_freq != UINT_MAX) { | ||
309 | next_f = sg_policy->next_freq; | 310 | next_f = sg_policy->next_freq; |
310 | 311 | ||
311 | /* Reset cached freq as next_freq has changed */ | 312 | /* Reset cached freq as next_freq has changed */ |