OSDN Git Service

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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Aug 2019 08:47:46 +0000 (10:47 +0200)
commit7c001e5aab6dcf4883d67fe3154ce73725251f47
tree8b7a3df6d0075193513e3a5ad921396ec9531555
parent7f68aa2e3e1bfa03a4e34e02d81718a4c19b47db
cpufreq: schedutil: Don't skip freq update when limits change

commit 600f5badb78c316146d062cfd7af4a2cfb655baa upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/sched/cpufreq_schedutil.c