Patch "cpufreq: schedutil: Fix superfluous updates caused by need_freq_update" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    cpufreq: schedutil: Fix superfluous updates caused by need_freq_update

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cpufreq-schedutil-fix-superfluous-updates-caused-by-.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8680a2cac65152bf0b7d3f3d65504f1437b1eb51
Author: Sultan Alsawaf (unemployed) <sultan@xxxxxxxxxxxxxxx>
Date:   Wed Dec 11 17:57:32 2024 -0800

    cpufreq: schedutil: Fix superfluous updates caused by need_freq_update
    
    [ Upstream commit 8e461a1cb43d69d2fc8a97e61916dce571e6bb31 ]
    
    A redundant frequency update is only truly needed when there is a policy
    limits change with a driver that specifies CPUFREQ_NEED_UPDATE_LIMITS.
    
    In spite of that, drivers specifying CPUFREQ_NEED_UPDATE_LIMITS receive a
    frequency update _all the time_, not just for a policy limits change,
    because need_freq_update is never cleared.
    
    Furthermore, ignore_dl_rate_limit()'s usage of need_freq_update also leads
    to a redundant frequency update, regardless of whether or not the driver
    specifies CPUFREQ_NEED_UPDATE_LIMITS, when the next chosen frequency is the
    same as the current one.
    
    Fix the superfluous updates by only honoring CPUFREQ_NEED_UPDATE_LIMITS
    when there's a policy limits change, and clearing need_freq_update when a
    requisite redundant update occurs.
    
    This is neatly achieved by moving up the CPUFREQ_NEED_UPDATE_LIMITS test
    and instead setting need_freq_update to false in sugov_update_next_freq().
    
    Fixes: 600f5badb78c ("cpufreq: schedutil: Don't skip freq update when limits change")
    Signed-off-by: Sultan Alsawaf (unemployed) <sultan@xxxxxxxxxxxxxxx>
    Reviewed-by: Christian Loehle <christian.loehle@xxxxxxx>
    Link: https://patch.msgid.link/20241212015734.41241-2-sultan@xxxxxxxxxxxxxxx
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 7f6bb37d3a2f7..e23a0fc96a7d2 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -91,7 +91,7 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
 
 	if (unlikely(sg_policy->limits_changed)) {
 		sg_policy->limits_changed = false;
-		sg_policy->need_freq_update = true;
+		sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
 		return true;
 	}
 
@@ -104,7 +104,7 @@ static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
 				   unsigned int next_freq)
 {
 	if (sg_policy->need_freq_update)
-		sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
+		sg_policy->need_freq_update = false;
 	else if (sg_policy->next_freq == next_freq)
 		return false;
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux