Patch "cpufreq/schedutil: Use a fixed reference frequency" has been added to the 6.7-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: Use a fixed reference frequency

to the 6.7-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-use-a-fixed-reference-frequency.patch
and it can be found in the queue-6.7 subdirectory.

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



commit d40f5e9b1ae695a3940b16ad9dfdb0c0ebc8ee1e
Author: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Date:   Mon Dec 11 11:48:51 2023 +0100

    cpufreq/schedutil: Use a fixed reference frequency
    
    [ Upstream commit b3edde44e5d4504c23a176819865cd603fd16d6c ]
    
    cpuinfo.max_freq can change at runtime because of boost as an example. This
    implies that the value could be different than the one that has been
    used when computing the capacity of a CPU.
    
    The new arch_scale_freq_ref() returns a fixed and coherent reference
    frequency that can be used when computing a frequency based on utilization.
    
    Use this arch_scale_freq_ref() when available and fallback to
    policy otherwise.
    
    Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
    Tested-by: Lukasz Luba <lukasz.luba@xxxxxxx>
    Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>
    Reviewed-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
    Acked-by: Rafael J. Wysocki <rafael@xxxxxxxxxx>
    Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231211104855.558096-4-vincent.guittot@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 5888176354e2..11422c054c84 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -114,6 +114,28 @@ static void sugov_deferred_update(struct sugov_policy *sg_policy)
 	}
 }
 
+/**
+ * get_capacity_ref_freq - get the reference frequency that has been used to
+ * correlate frequency and compute capacity for a given cpufreq policy. We use
+ * the CPU managing it for the arch_scale_freq_ref() call in the function.
+ * @policy: the cpufreq policy of the CPU in question.
+ *
+ * Return: the reference CPU frequency to compute a capacity.
+ */
+static __always_inline
+unsigned long get_capacity_ref_freq(struct cpufreq_policy *policy)
+{
+	unsigned int freq = arch_scale_freq_ref(policy->cpu);
+
+	if (freq)
+		return freq;
+
+	if (arch_scale_freq_invariant())
+		return policy->cpuinfo.max_freq;
+
+	return policy->cur;
+}
+
 /**
  * get_next_freq - Compute a new frequency for a given cpufreq policy.
  * @sg_policy: schedutil policy object to compute the new frequency for.
@@ -140,9 +162,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
 				  unsigned long util, unsigned long max)
 {
 	struct cpufreq_policy *policy = sg_policy->policy;
-	unsigned int freq = arch_scale_freq_invariant() ?
-				policy->cpuinfo.max_freq : policy->cur;
+	unsigned int freq;
 
+	freq = get_capacity_ref_freq(policy);
 	util = map_util_perf(util);
 	freq = map_util_freq(util, freq, max);
 




[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