diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-05-09 11:44:56 +0200 |
|---|---|---|
| committer | Georg Veichtlbauer <georg@vware.at> | 2023-07-27 17:52:37 +0200 |
| commit | e60c3deb3fad2e04306deb4e693340bfaa3cc0d7 (patch) | |
| tree | 5df9bb3e385223e9d618dce2ab2707d7097c2228 | |
| parent | 25c2cb9e8de74aa2460141542cdcb2fd03c94cba (diff) | |
BACKPORT: 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+
Change-Id: Idf4ebe9e912f983598255167d2065e47562ab83d
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>
(cherry picked from commit 97739501f207efe33145b918817f305b822987f8)
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
| -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 a50b0435db39..869a125ebb87 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -328,7 +328,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, * Do not reduce the frequency if the CPU has not been idle * recently, as the reduction is likely to be premature then. */ - if (busy && next_f < sg_policy->next_freq) { + if (busy && next_f < sg_policy->next_freq && + sg_policy->next_freq != UINT_MAX) { next_f = sg_policy->next_freq; /* Reset cached freq as next_freq has changed */ |
