]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpufreq: schedutil: Simplify sugov_update_next_freq()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 12 Nov 2020 19:26:42 +0000 (20:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:46:48 +0000 (12:46 +0100)
[ Upstream commit 90ac908a418b836427d6eaf84fbc5062881747fd ]

Rearrange a conditional to make it more straightforward.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Stable-dep-of: 8e461a1cb43d ("cpufreq: schedutil: Fix superfluous updates caused by need_freq_update")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/cpufreq_schedutil.c

index 5e39da0ae0868756819d096717422e67ccda7998..04295212ab5009b568575bcc85c6d6437b1691c0 100644 (file)
@@ -102,12 +102,10 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
                                   unsigned int next_freq)
 {
-       if (!sg_policy->need_freq_update) {
-               if (sg_policy->next_freq == next_freq)
-                       return false;
-       } else {
+       if (sg_policy->need_freq_update)
                sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
-       }
+       else if (sg_policy->next_freq == next_freq)
+               return false;
 
        sg_policy->next_freq = next_freq;
        sg_policy->last_freq_update_time = time;