Merge tag 'sched-urgent-2024-01-18' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 18 Jan 2024 19:57:33 +0000 (11:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 18 Jan 2024 19:57:33 +0000 (11:57 -0800)
Pull scheduler fix from Ingo Molnar:
 "Fix a cpufreq related performance regression on certain systems, where
  the CPU would remain at the lowest frequency, degrading performance
  substantially"

* tag 'sched-urgent-2024-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/fair: Fix frequency selection for non-invariant case

kernel/sched/cpufreq_schedutil.c

index 95c3c097083e505f41931168cef46f84cf4fac52..eece6244f9d2fea301f5523ef1d7d6779f0d4625 100644 (file)
@@ -133,7 +133,11 @@ unsigned long get_capacity_ref_freq(struct cpufreq_policy *policy)
        if (arch_scale_freq_invariant())
                return policy->cpuinfo.max_freq;
 
-       return policy->cur;
+       /*
+        * Apply a 25% margin so that we select a higher frequency than
+        * the current one before the CPU is fully busy:
+        */
+       return policy->cur + (policy->cur >> 2);
 }
 
 /**