On 14-02-21, 11:44, Yue Hu wrote: > On Fri, 12 Feb 2021 17:14:03 +0100 > "Rafael J. Wysocki" <raf...@kernel.org> wrote: > > This may be running in parallel with sugov_update_next_freq() on a > > different CPU, so the latter may clear need_freq_update right after it > > has been set here unless I'm overlooking something. > > Whether this logic is also happening for limits_changed in > sugo_should_update_freq() or not?
It is but it shouldn't have any side effects as we calculate the next frequency after cleaning the limits_changed flag. Your patch would have been fine, but it is not anymore because of commit 23a881852f3e ("cpufreq: schedutil: Don't skip freq update if need_freq_update is set"). It made a considerable change after which your patch adds a bug. With 23a881852f3e, need_freq_update is updated/cleared after the next frequency is calculated, while earlier it was cleared before it. And so even with the race condition taking place, there were no issues. -- viresh