Patch "cpufreq: schedutil: Update next_freq when cpufreq_limits change" has been added to the 6.5-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: Update next_freq when cpufreq_limits change

to the 6.5-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-update-next_freq-when-cpufreq_limi.patch
and it can be found in the queue-6.5 subdirectory.

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



commit 00a3e540993685226292b6223c4bd84c38a671f8
Author: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
Date:   Wed Jul 19 21:05:27 2023 +0800

    cpufreq: schedutil: Update next_freq when cpufreq_limits change
    
    [ Upstream commit 9e0bc36ab07c550d791bf17feeb479f1dfc42d89 ]
    
    When cpufreq's policy is 'single', there is a scenario that will
    cause sg_policy's next_freq to be unable to update.
    
    When the CPU's util is always max, the cpufreq will be max,
    and then if we change the policy's scaling_max_freq to be a
    lower freq, indeed, the sg_policy's next_freq need change to
    be the lower freq, however, because the cpu_is_busy, the next_freq
    would keep the max_freq.
    
    For example:
    
    The cpu7 is a single CPU:
    
      unisoc:/sys/devices/system/cpu/cpufreq/policy7 # while true;do done& [1] 4737
      unisoc:/sys/devices/system/cpu/cpufreq/policy7 # taskset -p 80 4737
      pid 4737's current affinity mask: ff
      pid 4737's new affinity mask: 80
      unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_max_freq
      2301000
      unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_cur_freq
      2301000
      unisoc:/sys/devices/system/cpu/cpufreq/policy7 # echo 2171000 > scaling_max_freq
      unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_max_freq
      2171000
    
    At this time, the sg_policy's next_freq would stay at 2301000, which
    is wrong.
    
    To fix this, add a check for the ->need_freq_update flag.
    
    [ mingo: Clarified the changelog. ]
    
    Co-developed-by: Guohua Yan <guohua.yan@xxxxxxxxxx>
    Signed-off-by: Xuewen Yan <xuewen.yan@xxxxxxxxxx>
    Signed-off-by: Guohua Yan <guohua.yan@xxxxxxxxxx>
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
    Acked-by: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230719130527.8074-1-xuewen.yan@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 4492608b7d7f1..458d359f5991c 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -350,7 +350,8 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time,
 	 * Except when the rq is capped by uclamp_max.
 	 */
 	if (!uclamp_rq_is_capped(cpu_rq(sg_cpu->cpu)) &&
-	    sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
+	    sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq &&
+	    !sg_policy->need_freq_update) {
 		next_f = sg_policy->next_freq;
 
 		/* Restore cached freq as next_freq has changed */



[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