cpufreq: schedutil: Don't skip freq update when limits change
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 7 Aug 2019 07:06:01 +0000 (12:36 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 10 Aug 2019 11:53:19 +0000 (13:53 +0200)
commit600f5badb78c316146d062cfd7af4a2cfb655baa
treebe9a9feaed5dc12e706866c1de69f2811c091d40
parente61a41256edf9f425039129757af4a80b5ed8162
cpufreq: schedutil: Don't skip freq update when limits change

To avoid reducing the frequency of a CPU prematurely, we skip reducing
the frequency if the CPU had been busy recently.

This should not be done when the limits of the policy are changed, for
example due to thermal throttling. We should always get the frequency
within the new limits as soon as possible.

Trying to fix this by using only one flag, i.e. need_freq_update, can
lead to a race condition where the flag gets cleared without forcing us
to change the frequency at least once. And so this patch introduces
another flag to avoid that race condition.

Fixes: ecd288429126 ("cpufreq: schedutil: Don't set next_freq to UINT_MAX")
Cc: v4.18+ <stable@vger.kernel.org> # v4.18+
Reported-by: Doug Smythies <dsmythies@telus.net>
Tested-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/sched/cpufreq_schedutil.c