* [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
@ 2026-11-24 11:56 James Buck
2026-11-24 13:15 ` Andrea Righi
2026-11-24 15:18 ` Vincent Guittot
0 siblings, 2 replies; 8+ messages in thread
From: James Buck @ 2026-11-24 11:56 UTC (permalink / raw)
To: K Prateek Nayak, Andrea Righi
Cc: Peter Zijlstra, Ingo Molnar, Vincent Guittot, Juri Lelli,
Dietmar Eggemann, Valentin Schneider, linux-kernel, regressions
Hi,
Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
#regzbot introduced: 61ea17a63719
System
------
Orange Pi 6 (CIX CD8180 "Sky1"), 12 CPUs in five clusters, ACPI boot, no SMT:
CPUs capacity
0-1 1024
2-5 279 (little)
6-7 905
8-9 866
10-11 984
The firmware's PPTT gives one MC domain over all 12 CPUs. It has SD_ASYM_CPUCAPACITY(_FULL) and SD_SHARE_LLC, with a CLS domain per cluster below it. The kernel is v7.3.5 plus the out-of-tree Sky1 SoC
driver patches the board needs to boot. None of them touch kernel/sched/; the only one in drivers/base/arch_topology.c adds a helper that updates capacity_freq_ref when boost is toggled.
Workload
--------
llama.cpp llama-bench, Qwen2.5 1.5B Instruct Q4_K_M, CPU only, 8 threads, pp512 / tg128, tokens/s:
6.18.64 123.5 / 36.5
7.3.5 109.0 / 29.5
7.3.5, taskset to the 8 big CPUs 121.4 / 34.7
7.3.5, NO_SIS_UTIL at runtime 122.1 / 35.9
7.3.5, patch below 121.7 / 35.7
Sampling each worker thread's CPU every 5 s on stock 7.3.5 showed one to four of the 8 threads on cpu2-5 in every sample, with big CPUs idle. With NO_SIS_UTIL, or with the patch below, threads only make brief visits to the little CPUs. That costs nothing measurable, and 6.18 does the same. llama.cpp syncs all threads at a barrier after every operation, so one thread on a 279-capacity CPU holds up the other seven.
Other things I ruled out with runtime toggles or test builds: EAS off, llc_balancing off, the performance governor, NI_RATE/NI_RANDOM, the 6.18 misfit logic, and restoring the old sd_init() rule that cleared SD_PREFER_SIBLING on the child of an asymmetric domain. None of them changed the result. The slowdown only shows when prompt processing is part of the run, where the workers block and wake far more often than during generation, which points at the wakeup path.
What I think happens
--------------------
The workers' util is about 850-1018, so they fit no CPU, not even a 1024 one (the limit there is about 819). select_idle_capacity() therefore never returns early. It returns the highest-capacity idle CPU among those it scanned.
With 8 of 12 CPUs busy, nr_idle_scan comes out at about 6:
x = 7200 / 12 = 600
y = 1024 - 600^2 * 117^2 / (10000 * 1024) = ~543
nr = 12 * 543 / 1024 = ~6
So the scan stops after six CPUs counted from target. From cpu0 that is cpu0-5. With cpu0 and cpu1 busy, the best idle CPU it can see is a little one, and the idle cpu6-11 are never checked. From cpu10 the scan covers 10, 11, 0, 1, 2 and 3, with the same result. Once a thread is on a little CPU, its next scan starts there, so it tends to stay.
Above about 85% load nr drops to 1 and the function returns -1 at once.
The CPU numbering here (littles between two groups of bigs) makes it easy to hit. But the effect looks general: for a task that fits no CPU, a scan cut short by nr returns the best of a partial set. On a system with the littles at 0-3 and the bigs at 4-7, a wakeup with target on a little CPU and nr <= 4 sees only little CPUs.
The patch below (drop the limit from select_idle_capacity() only; select_idle_cpu() keeps SIS_UTIL) is what I run now.
I'm not proposing it as the fix, since it gives up what the commit wanted on large asymmetric domains.
One option might be to keep scanning past nr while nothing has been found that fits. I'm happy to test anything on this board, and I can send the topology and sched domain dumps, /proc/schedstat, or traces if they help.
Thanks,
James
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9049,7 +9049,6 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
int fits, best_fits = ASYM_IDLE_THREAD_MISFIT;
int cpu, best_cpu = -1;
struct cpumask *cpus;
- int nr = INT_MAX;
cpus = this_cpu_cpumask_var_ptr(select_rq_mask);
cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
@@ -9058,28 +9057,17 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
util_min = uclamp_eff_value(p, UCLAMP_MIN);
util_max = uclamp_eff_value(p, UCLAMP_MAX);
- if (sched_feat(SIS_UTIL) && sd->shared) {
- /*
- * Same nr_idle_scan hint as select_idle_cpu(), nr only limits
- * the scan when not preferring an idle core.
- */
- nr = READ_ONCE(sd->shared->nr_idle_scan) + 1;
- /* overloaded domain is unlikely to have idle cpu/core */
- if (nr == 1)
- return -1;
- }
-
+ /*
+ * Scan the whole domain, as 6.18 did. Do not cut the scan short with
+ * the SIS_UTIL nr_idle_scan hint: on a busy system the hint drops to a
+ * few CPUs, the scan then stops at whatever idle CPU it met first, and
+ * a task that fits no CPU (util above every capacity margin) lands on
+ * an idle little core while an idle big core is never looked at.
+ */
for_each_cpu_wrap(cpu, cpus, target) {
bool preferred_core = !has_idle_core || is_core_idle(cpu);
unsigned long cpu_cap = capacity_of(cpu);
- /*
- * Stop when the nr_idle_scan is exhausted (mirrors
- * select_idle_cpu() logic).
- */
- if (!has_idle_core && --nr <= 0)
- return best_cpu;
-
if (!choose_idle_cpu(cpu, p))
continue;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-24 11:56 [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle James Buck
@ 2026-11-24 13:15 ` Andrea Righi
2026-11-25 2:53 ` K Prateek Nayak
2026-11-24 15:18 ` Vincent Guittot
1 sibling, 1 reply; 8+ messages in thread
From: Andrea Righi @ 2026-11-24 13:15 UTC (permalink / raw)
To: James Buck
Cc: K Prateek Nayak, Peter Zijlstra, Ingo Molnar, Vincent Guittot,
Juri Lelli, Dietmar Eggemann, Valentin Schneider, Usama Arif,
linux-kernel, regressions
Hi James,
On Tue, Nov 24, 2026 at 11:56:52AM +0000, James Buck wrote:
> Hi,
>
> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
>
> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
A related regression from the same commit was reported by Usama here:
https://lore.kernel.org/r/20261113153157.2495664-1-usama.arif@linux.dev/
On Grace, a zero SIS_UTIL budget skips the search despite suitable CPUs
being idle. Your case shows that a nonzero budget can stop the scan
before reaching an idle big CPU.
We've discussed a minimum scan budget and accounting for idle CPU
availability, though a small minimum alone may not fix your case.
Given both reports, reverting the commit seems the safest thing to do
for now. That would restore the previous asym search behavior and we can
revisit a better consistent strategy to cover both sym and asym CPU
selection later.
Prateek, Vincent, what do you think?
Thanks,
-Andrea
>
> #regzbot introduced: 61ea17a63719
>
> System
> ------
> Orange Pi 6 (CIX CD8180 "Sky1"), 12 CPUs in five clusters, ACPI boot, no SMT:
>
> CPUs capacity
> 0-1 1024
> 2-5 279 (little)
> 6-7 905
> 8-9 866
> 10-11 984
>
> The firmware's PPTT gives one MC domain over all 12 CPUs. It has SD_ASYM_CPUCAPACITY(_FULL) and SD_SHARE_LLC, with a CLS domain per cluster below it. The kernel is v7.3.5 plus the out-of-tree Sky1 SoC
> driver patches the board needs to boot. None of them touch kernel/sched/; the only one in drivers/base/arch_topology.c adds a helper that updates capacity_freq_ref when boost is toggled.
>
> Workload
> --------
> llama.cpp llama-bench, Qwen2.5 1.5B Instruct Q4_K_M, CPU only, 8 threads, pp512 / tg128, tokens/s:
>
> 6.18.64 123.5 / 36.5
> 7.3.5 109.0 / 29.5
>
> 7.3.5, taskset to the 8 big CPUs 121.4 / 34.7
> 7.3.5, NO_SIS_UTIL at runtime 122.1 / 35.9
> 7.3.5, patch below 121.7 / 35.7
>
> Sampling each worker thread's CPU every 5 s on stock 7.3.5 showed one to four of the 8 threads on cpu2-5 in every sample, with big CPUs idle. With NO_SIS_UTIL, or with the patch below, threads only make brief visits to the little CPUs. That costs nothing measurable, and 6.18 does the same. llama.cpp syncs all threads at a barrier after every operation, so one thread on a 279-capacity CPU holds up the other seven.
>
> Other things I ruled out with runtime toggles or test builds: EAS off, llc_balancing off, the performance governor, NI_RATE/NI_RANDOM, the 6.18 misfit logic, and restoring the old sd_init() rule that cleared SD_PREFER_SIBLING on the child of an asymmetric domain. None of them changed the result. The slowdown only shows when prompt processing is part of the run, where the workers block and wake far more often than during generation, which points at the wakeup path.
>
> What I think happens
> --------------------
> The workers' util is about 850-1018, so they fit no CPU, not even a 1024 one (the limit there is about 819). select_idle_capacity() therefore never returns early. It returns the highest-capacity idle CPU among those it scanned.
>
> With 8 of 12 CPUs busy, nr_idle_scan comes out at about 6:
>
> x = 7200 / 12 = 600
> y = 1024 - 600^2 * 117^2 / (10000 * 1024) = ~543
>
> nr = 12 * 543 / 1024 = ~6
>
> So the scan stops after six CPUs counted from target. From cpu0 that is cpu0-5. With cpu0 and cpu1 busy, the best idle CPU it can see is a little one, and the idle cpu6-11 are never checked. From cpu10 the scan covers 10, 11, 0, 1, 2 and 3, with the same result. Once a thread is on a little CPU, its next scan starts there, so it tends to stay.
> Above about 85% load nr drops to 1 and the function returns -1 at once.
>
> The CPU numbering here (littles between two groups of bigs) makes it easy to hit. But the effect looks general: for a task that fits no CPU, a scan cut short by nr returns the best of a partial set. On a system with the littles at 0-3 and the bigs at 4-7, a wakeup with target on a little CPU and nr <= 4 sees only little CPUs.
>
> The patch below (drop the limit from select_idle_capacity() only; select_idle_cpu() keeps SIS_UTIL) is what I run now.
>
> I'm not proposing it as the fix, since it gives up what the commit wanted on large asymmetric domains.
>
> One option might be to keep scanning past nr while nothing has been found that fits. I'm happy to test anything on this board, and I can send the topology and sched domain dumps, /proc/schedstat, or traces if they help.
>
> Thanks,
> James
>
>
>
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9049,7 +9049,6 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
> int fits, best_fits = ASYM_IDLE_THREAD_MISFIT;
> int cpu, best_cpu = -1;
> struct cpumask *cpus;
> - int nr = INT_MAX;
>
> cpus = this_cpu_cpumask_var_ptr(select_rq_mask);
> cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
> @@ -9058,28 +9057,17 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
> util_min = uclamp_eff_value(p, UCLAMP_MIN);
> util_max = uclamp_eff_value(p, UCLAMP_MAX);
>
> - if (sched_feat(SIS_UTIL) && sd->shared) {
> - /*
> - * Same nr_idle_scan hint as select_idle_cpu(), nr only limits
> - * the scan when not preferring an idle core.
> - */
> - nr = READ_ONCE(sd->shared->nr_idle_scan) + 1;
> - /* overloaded domain is unlikely to have idle cpu/core */
> - if (nr == 1)
> - return -1;
> - }
> -
> + /*
> + * Scan the whole domain, as 6.18 did. Do not cut the scan short with
> + * the SIS_UTIL nr_idle_scan hint: on a busy system the hint drops to a
> + * few CPUs, the scan then stops at whatever idle CPU it met first, and
> + * a task that fits no CPU (util above every capacity margin) lands on
> + * an idle little core while an idle big core is never looked at.
> + */
> for_each_cpu_wrap(cpu, cpus, target) {
> bool preferred_core = !has_idle_core || is_core_idle(cpu);
> unsigned long cpu_cap = capacity_of(cpu);
>
> - /*
> - * Stop when the nr_idle_scan is exhausted (mirrors
> - * select_idle_cpu() logic).
> - */
> - if (!has_idle_core && --nr <= 0)
> - return best_cpu;
> -
> if (!choose_idle_cpu(cpu, p))
> continue;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-24 13:15 ` Andrea Righi
@ 2026-11-25 2:53 ` K Prateek Nayak
2026-11-25 7:51 ` Vincent Guittot
0 siblings, 1 reply; 8+ messages in thread
From: K Prateek Nayak @ 2026-11-25 2:53 UTC (permalink / raw)
To: Andrea Righi, James Buck
Cc: Peter Zijlstra, Ingo Molnar, Vincent Guittot, Juri Lelli,
Dietmar Eggemann, Valentin Schneider, Usama Arif, linux-kernel,
regressions
Hello Andrea,
On 11/24/2026 6:45 PM, Andrea Righi wrote:
> Hi James,
>
> On Tue, Nov 24, 2026 at 11:56:52AM +0000, James Buck wrote:
>> Hi,
>>
>> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
>>
>> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
>
> A related regression from the same commit was reported by Usama here:
> https://lore.kernel.org/r/20261113153157.2495664-1-usama.arif@linux.dev/
>
> On Grace, a zero SIS_UTIL budget skips the search despite suitable CPUs
> being idle. Your case shows that a nonzero budget can stop the scan
> before reaching an idle big CPU.
>
> We've discussed a minimum scan budget and accounting for idle CPU
> availability, though a small minimum alone may not fix your case.
This had problems in the past when Chenyu was iterating on SIS_UTIL
where the search opportunity at higher utilization is actually very
low and cutting off search for !idle core was beneficial for SMT
systems.
Now, for systems without SMT, it has its benefits too but a system
without SMT should be equivalent to a SMT one where test_idle_core()
returns true always if an idle CPU is present.
So I'm wondering if {set,test}_idle_cores() can be extended !SMT
to act like a gating indicator to say if an idle core exists or
not much like how !get_rd_overloaded(this_rq->rd) serves as a
gate for newidle balance - it can be flipped to true when a CPU
goes idle or if load balancer sees an idle CPU. Thoughts?
> Given both reports, reverting the commit seems the safest thing to do
> for now. That would restore the previous asym search behavior and we can
> revisit a better consistent strategy to cover both sym and asym CPU
> selection later.
>
> Prateek, Vincent, what do you think?
IMO it still makes sense for SMT systems since capacity on systems
with SMT only makes sense if the entire core is idle and then it is
just a best effort thing right?
set_idle_cores(), would flip the flag as soon as an idle core is
available and after that SIS_UTIL is bypassed. I don't think the
SIS_UTIL cut-off for non-SMT ASYM_CAPACITY systems makes that much
sense given misfit penalty is much higher.
--
Thanks and Regards,
Prateek
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-25 2:53 ` K Prateek Nayak
@ 2026-11-25 7:51 ` Vincent Guittot
2026-11-25 10:27 ` Chen Yu
0 siblings, 1 reply; 8+ messages in thread
From: Vincent Guittot @ 2026-11-25 7:51 UTC (permalink / raw)
To: K Prateek Nayak
Cc: Andrea Righi, James Buck, Peter Zijlstra, Ingo Molnar,
Juri Lelli, Dietmar Eggemann, Valentin Schneider, Usama Arif,
linux-kernel, regressions
On Wed, 25 Nov 2026 at 03:53, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
>
> Hello Andrea,
>
> On 11/24/2026 6:45 PM, Andrea Righi wrote:
> > Hi James,
> >
> > On Tue, Nov 24, 2026 at 11:56:52AM +0000, James Buck wrote:
> >> Hi,
> >>
> >> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
> >>
> >> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
> >
> > A related regression from the same commit was reported by Usama here:
> > https://lore.kernel.org/r/20261113153157.2495664-1-usama.arif@linux.dev/
> >
> > On Grace, a zero SIS_UTIL budget skips the search despite suitable CPUs
> > being idle. Your case shows that a nonzero budget can stop the scan
> > before reaching an idle big CPU.
> >
> > We've discussed a minimum scan budget and accounting for idle CPU
> > availability, though a small minimum alone may not fix your case.
>
> This had problems in the past when Chenyu was iterating on SIS_UTIL
> where the search opportunity at higher utilization is actually very
> low and cutting off search for !idle core was beneficial for SMT
> systems.
>
> Now, for systems without SMT, it has its benefits too but a system
> without SMT should be equivalent to a SMT one where test_idle_core()
> returns true always if an idle CPU is present.
>
> So I'm wondering if {set,test}_idle_cores() can be extended !SMT
> to act like a gating indicator to say if an idle core exists or
> not much like how !get_rd_overloaded(this_rq->rd) serves as a
> gate for newidle balance - it can be flipped to true when a CPU
> goes idle or if load balancer sees an idle CPU. Thoughts?
I tested idle_cores tracking for !SMT and EAS months ago [1]
[1] https://lore.kernel.org/all/20251202181242.1536213-6-vincent.guittot@linaro.org/
>
> > Given both reports, reverting the commit seems the safest thing to do
> > for now. That would restore the previous asym search behavior and we can
> > revisit a better consistent strategy to cover both sym and asym CPU
> > selection later.
> >
> > Prateek, Vincent, what do you think?
>
> IMO it still makes sense for SMT systems since capacity on systems
> with SMT only makes sense if the entire core is idle and then it is
> just a best effort thing right?
>
> set_idle_cores(), would flip the flag as soon as an idle core is
> available and after that SIS_UTIL is bypassed. I don't think the
> SIS_UTIL cut-off for non-SMT ASYM_CAPACITY systems makes that much
> sense given misfit penalty is much higher.
In fact that depends on the number of CPUs in your LLC.
The current SIS_UTIL is unfair for small system because you skip the
loop with "low" utilization:
- with 12 cores per LLC, you skip the loop if the avg utilization per
cpu is above 839 whereas it also means that you have the compute
capacity of more than 2 CPUs that is not used and util_est can worse
the situation
- but with 64 cores LLC, you still tries 5 CPUs for the same avg
utilization per CPU
- and with 12864 cores LLC, it's 10 CPUs
>
> --
> Thanks and Regards,
> Prateek
>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-25 7:51 ` Vincent Guittot
@ 2026-11-25 10:27 ` Chen Yu
2026-11-25 14:27 ` Vincent Guittot
0 siblings, 1 reply; 8+ messages in thread
From: Chen Yu @ 2026-11-25 10:27 UTC (permalink / raw)
To: Vincent Guittot
Cc: K Prateek Nayak, Andrea Righi, James Buck, Peter Zijlstra,
Ingo Molnar, Juri Lelli, Dietmar Eggemann, Valentin Schneider,
Usama Arif, linux-kernel, regressions
On Wed, Nov 25, 2026 at 08:51:39AM +0100, Vincent Guittot wrote:
> On Wed, 25 Nov 2026 at 03:53, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
> >
> > Hello Andrea,
> >
> > On 11/24/2026 6:45 PM, Andrea Righi wrote:
> > > Hi James,
> > >
> > > On Tue, Nov 24, 2026 at 11:56:52AM +0000, James Buck wrote:
> > >> Hi,
> > >>
> > >> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
> > >>
> > >> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
> > >
> > > A related regression from the same commit was reported by Usama here:
> > > https://lore.kernel.org/r/20261113153157.2495664-1-usama.arif@linux.dev/
> > >
> > > On Grace, a zero SIS_UTIL budget skips the search despite suitable CPUs
> > > being idle. Your case shows that a nonzero budget can stop the scan
> > > before reaching an idle big CPU.
> > >
> > > We've discussed a minimum scan budget and accounting for idle CPU
> > > availability, though a small minimum alone may not fix your case.
> >
> > This had problems in the past when Chenyu was iterating on SIS_UTIL
> > where the search opportunity at higher utilization is actually very
> > low and cutting off search for !idle core was beneficial for SMT
> > systems.
> >
> > Now, for systems without SMT, it has its benefits too but a system
> > without SMT should be equivalent to a SMT one where test_idle_core()
> > returns true always if an idle CPU is present.
> >
> > So I'm wondering if {set,test}_idle_cores() can be extended !SMT
> > to act like a gating indicator to say if an idle core exists or
> > not much like how !get_rd_overloaded(this_rq->rd) serves as a
> > gate for newidle balance - it can be flipped to true when a CPU
> > goes idle or if load balancer sees an idle CPU. Thoughts?
>
> I tested idle_cores tracking for !SMT and EAS months ago [1]
> [1] https://lore.kernel.org/all/20251202181242.1536213-6-vincent.guittot@linaro.org/
>
> >
> > > Given both reports, reverting the commit seems the safest thing to do
> > > for now. That would restore the previous asym search behavior and we can
> > > revisit a better consistent strategy to cover both sym and asym CPU
> > > selection later.
> > >
> > > Prateek, Vincent, what do you think?
> >
> > IMO it still makes sense for SMT systems since capacity on systems
> > with SMT only makes sense if the entire core is idle and then it is
> > just a best effort thing right?
> >
> > set_idle_cores(), would flip the flag as soon as an idle core is
> > available and after that SIS_UTIL is bypassed. I don't think the
> > SIS_UTIL cut-off for non-SMT ASYM_CAPACITY systems makes that much
> > sense given misfit penalty is much higher.
>
> In fact that depends on the number of CPUs in your LLC.
> The current SIS_UTIL is unfair for small system because you skip the
> loop with "low" utilization:
> - with 12 cores per LLC, you skip the loop if the avg utilization per
> cpu is above 839 whereas it also means that you have the compute
> capacity of more than 2 CPUs that is not used and util_est can worse
> the situation
> - but with 64 cores LLC, you still tries 5 CPUs for the same avg
> utilization per CPU
> - and with 12864 cores LLC, it's 10 CPUs
>
>
As you suggested in [1], maybe we can give a floor value of 3 when has_idle_core
is true both for SMT and !SMT case(mainly for nr_scan = 0 case). Besides, we can
scale up the number of CPUs to be scanned by their llc_weight, to fake
a 32 CPUs LLC for the small LLC system, this should mitigate
the issue of current report and the issue reported at [1].
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index da0d9e19c457..1c0e2ac7751d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12937,8 +12937,9 @@ static void update_idle_cpu_scan(struct lb_env *env,
y = SCHED_CAPACITY_SCALE - tmp;
/* equation [2] */
- y *= llc_weight;
+ y *= max(llc_weight, 32);
do_div(y, SCHED_CAPACITY_SCALE);
+ y = min_t(u64, y, llc_weight);
if ((int)y != sd_share->nr_idle_scan)
WRITE_ONCE(sd_share->nr_idle_scan, (int)y);
}
--
2.25.1
[1] https://lore.kernel.org/all/CAKfTPtDVqKyQ491MdUr2RbGmJ9ivofiiX7D7Xd-Sh2F0NLFmRw@mail.gmail.com/
> >
> > --
> > Thanks and Regards,
> > Prateek
> >
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-25 10:27 ` Chen Yu
@ 2026-11-25 14:27 ` Vincent Guittot
0 siblings, 0 replies; 8+ messages in thread
From: Vincent Guittot @ 2026-11-25 14:27 UTC (permalink / raw)
To: Chen Yu
Cc: K Prateek Nayak, Andrea Righi, James Buck, Peter Zijlstra,
Ingo Molnar, Juri Lelli, Dietmar Eggemann, Valentin Schneider,
Usama Arif, linux-kernel, regressions
On Wed, 25 Nov 2026 at 11:38, Chen Yu <yu.c.chen@intel.com> wrote:
>
> On Wed, Nov 25, 2026 at 08:51:39AM +0100, Vincent Guittot wrote:
> > On Wed, 25 Nov 2026 at 03:53, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
> > >
> > > Hello Andrea,
> > >
> > > On 11/24/2026 6:45 PM, Andrea Righi wrote:
> > > > Hi James,
> > > >
> > > > On Tue, Nov 24, 2026 at 11:56:52AM +0000, James Buck wrote:
> > > >> Hi,
> > > >>
> > > >> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
> > > >>
> > > >> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
> > > >
> > > > A related regression from the same commit was reported by Usama here:
> > > > https://lore.kernel.org/r/20261113153157.2495664-1-usama.arif@linux.dev/
> > > >
> > > > On Grace, a zero SIS_UTIL budget skips the search despite suitable CPUs
> > > > being idle. Your case shows that a nonzero budget can stop the scan
> > > > before reaching an idle big CPU.
> > > >
> > > > We've discussed a minimum scan budget and accounting for idle CPU
> > > > availability, though a small minimum alone may not fix your case.
> > >
> > > This had problems in the past when Chenyu was iterating on SIS_UTIL
> > > where the search opportunity at higher utilization is actually very
> > > low and cutting off search for !idle core was beneficial for SMT
> > > systems.
> > >
> > > Now, for systems without SMT, it has its benefits too but a system
> > > without SMT should be equivalent to a SMT one where test_idle_core()
> > > returns true always if an idle CPU is present.
> > >
> > > So I'm wondering if {set,test}_idle_cores() can be extended !SMT
> > > to act like a gating indicator to say if an idle core exists or
> > > not much like how !get_rd_overloaded(this_rq->rd) serves as a
> > > gate for newidle balance - it can be flipped to true when a CPU
> > > goes idle or if load balancer sees an idle CPU. Thoughts?
> >
> > I tested idle_cores tracking for !SMT and EAS months ago [1]
> > [1] https://lore.kernel.org/all/20251202181242.1536213-6-vincent.guittot@linaro.org/
> >
> > >
> > > > Given both reports, reverting the commit seems the safest thing to do
> > > > for now. That would restore the previous asym search behavior and we can
> > > > revisit a better consistent strategy to cover both sym and asym CPU
> > > > selection later.
> > > >
> > > > Prateek, Vincent, what do you think?
> > >
> > > IMO it still makes sense for SMT systems since capacity on systems
> > > with SMT only makes sense if the entire core is idle and then it is
> > > just a best effort thing right?
> > >
> > > set_idle_cores(), would flip the flag as soon as an idle core is
> > > available and after that SIS_UTIL is bypassed. I don't think the
> > > SIS_UTIL cut-off for non-SMT ASYM_CAPACITY systems makes that much
> > > sense given misfit penalty is much higher.
> >
> > In fact that depends on the number of CPUs in your LLC.
> > The current SIS_UTIL is unfair for small system because you skip the
> > loop with "low" utilization:
> > - with 12 cores per LLC, you skip the loop if the avg utilization per
> > cpu is above 839 whereas it also means that you have the compute
> > capacity of more than 2 CPUs that is not used and util_est can worse
> > the situation
> > - but with 64 cores LLC, you still tries 5 CPUs for the same avg
> > utilization per CPU
> > - and with 12864 cores LLC, it's 10 CPUs
> >
> >
>
> As you suggested in [1], maybe we can give a floor value of 3 when has_idle_core
> is true both for SMT and !SMT case(mainly for nr_scan = 0 case). Besides, we can
> scale up the number of CPUs to be scanned by their llc_weight, to fake
> a 32 CPUs LLC for the small LLC system, this should mitigate
> the issue of current report and the issue reported at [1].
This fixes the regression on my radxa O6 by keeping nr_idle_scan full
for llc smaller than 32 CPUs while the avg utilization per CPU is
below ~550
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index da0d9e19c457..1c0e2ac7751d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12937,8 +12937,9 @@ static void update_idle_cpu_scan(struct lb_env *env,
> y = SCHED_CAPACITY_SCALE - tmp;
>
> /* equation [2] */
> - y *= llc_weight;
> + y *= max(llc_weight, 32);
> do_div(y, SCHED_CAPACITY_SCALE);
> + y = min_t(u64, y, llc_weight);
> if ((int)y != sd_share->nr_idle_scan)
> WRITE_ONCE(sd_share->nr_idle_scan, (int)y);
> }
> --
> 2.25.1
>
> [1] https://lore.kernel.org/all/CAKfTPtDVqKyQ491MdUr2RbGmJ9ivofiiX7D7Xd-Sh2F0NLFmRw@mail.gmail.com/
> > >
> > > --
> > > Thanks and Regards,
> > > Prateek
> > >
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-24 11:56 [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle James Buck
2026-11-24 13:15 ` Andrea Righi
@ 2026-11-24 15:18 ` Vincent Guittot
2026-11-24 18:41 ` Christian Loehle
1 sibling, 1 reply; 8+ messages in thread
From: Vincent Guittot @ 2026-11-24 15:18 UTC (permalink / raw)
To: James Buck
Cc: K Prateek Nayak, Andrea Righi, Peter Zijlstra, Ingo Molnar,
Juri Lelli, Dietmar Eggemann, Valentin Schneider, linux-kernel,
regressions
On Tue, 24 Nov 2026 at 12:56, James Buck <jbuck2005.linux@outlook.com> wrote:
>
> Hi,
>
> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
>
> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
>
> #regzbot introduced: 61ea17a63719
>
> System
> ------
> Orange Pi 6 (CIX CD8180 "Sky1"), 12 CPUs in five clusters, ACPI boot, no SMT:
>
> CPUs capacity
> 0-1 1024
> 2-5 279 (little)
> 6-7 905
> 8-9 866
> 10-11 984
>
> The firmware's PPTT gives one MC domain over all 12 CPUs. It has SD_ASYM_CPUCAPACITY(_FULL) and SD_SHARE_LLC, with a CLS domain per cluster below it. The kernel is v7.3.5 plus the out-of-tree Sky1 SoC
> driver patches the board needs to boot. None of them touch kernel/sched/; the only one in drivers/base/arch_topology.c adds a helper that updates capacity_freq_ref when boost is toggled.
>
> Workload
> --------
> llama.cpp llama-bench, Qwen2.5 1.5B Instruct Q4_K_M, CPU only, 8 threads, pp512 / tg128, tokens/s:
>
> 6.18.64 123.5 / 36.5
> 7.3.5 109.0 / 29.5
>
> 7.3.5, taskset to the 8 big CPUs 121.4 / 34.7
> 7.3.5, NO_SIS_UTIL at runtime 122.1 / 35.9
> 7.3.5, patch below 121.7 / 35.7
I have something similar on radxa O6 and 7.4-rc4 with latest tip/sched/core
- 7.4-rc4+tip : 124.4
- 7.4-rc4+tip NO_SIS_UTIL at runtime : 136.3
I'm surprised that the newly_idle and/or periodic load balance doesn't
pull the tasks earlier onto a mid/big core. It takes around 15/20ms to
migrate a long-running thread to a bigger core when it runs on a
little core whereas misfit should trigger an active load balance at
next tick. I wonder if the Cluster level could slow down this
migration.
>
> Sampling each worker thread's CPU every 5 s on stock 7.3.5 showed one to four of the 8 threads on cpu2-5 in every sample, with big CPUs idle. With NO_SIS_UTIL, or with the patch below, threads only make brief visits to the little CPUs. That costs nothing measurable, and 6.18 does the same. llama.cpp syncs all threads at a barrier after every operation, so one thread on a 279-capacity CPU holds up the other seven.
>
> Other things I ruled out with runtime toggles or test builds: EAS off, llc_balancing off, the performance governor, NI_RATE/NI_RANDOM, the 6.18 misfit logic, and restoring the old sd_init() rule that cleared SD_PREFER_SIBLING on the child of an asymmetric domain. None of them changed the result. The slowdown only shows when prompt processing is part of the run, where the workers block and wake far more often than during generation, which points at the wakeup path.
>
> What I think happens
> --------------------
> The workers' util is about 850-1018, so they fit no CPU, not even a 1024 one (the limit there is about 819). select_idle_capacity() therefore never returns early. It returns the highest-capacity idle CPU among those it scanned.
>
> With 8 of 12 CPUs busy, nr_idle_scan comes out at about 6:
>
> x = 7200 / 12 = 600
> y = 1024 - 600^2 * 117^2 / (10000 * 1024) = ~543
>
> nr = 12 * 543 / 1024 = ~6
>
> So the scan stops after six CPUs counted from target. From cpu0 that is cpu0-5. With cpu0 and cpu1 busy, the best idle CPU it can see is a little one, and the idle cpu6-11 are never checked. From cpu10 the scan covers 10, 11, 0, 1, 2 and 3, with the same result. Once a thread is on a little CPU, its next scan starts there, so it tends to stay.
> Above about 85% load nr drops to 1 and the function returns -1 at once.
>
> The CPU numbering here (littles between two groups of bigs) makes it easy to hit. But the effect looks general: for a task that fits no CPU, a scan cut short by nr returns the best of a partial set. On a system with the littles at 0-3 and the bigs at 4-7, a wakeup with target on a little CPU and nr <= 4 sees only little CPUs.
>
> The patch below (drop the limit from select_idle_capacity() only; select_idle_cpu() keeps SIS_UTIL) is what I run now.
>
> I'm not proposing it as the fix, since it gives up what the commit wanted on large asymmetric domains.
>
> One option might be to keep scanning past nr while nothing has been found that fits. I'm happy to test anything on this board, and I can send the topology and sched domain dumps, /proc/schedstat, or traces if they help.
>
> Thanks,
> James
>
>
>
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9049,7 +9049,6 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
> int fits, best_fits = ASYM_IDLE_THREAD_MISFIT;
> int cpu, best_cpu = -1;
> struct cpumask *cpus;
> - int nr = INT_MAX;
>
> cpus = this_cpu_cpumask_var_ptr(select_rq_mask);
> cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
> @@ -9058,28 +9057,17 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
> util_min = uclamp_eff_value(p, UCLAMP_MIN);
> util_max = uclamp_eff_value(p, UCLAMP_MAX);
>
> - if (sched_feat(SIS_UTIL) && sd->shared) {
> - /*
> - * Same nr_idle_scan hint as select_idle_cpu(), nr only limits
> - * the scan when not preferring an idle core.
> - */
> - nr = READ_ONCE(sd->shared->nr_idle_scan) + 1;
> - /* overloaded domain is unlikely to have idle cpu/core */
> - if (nr == 1)
> - return -1;
> - }
> -
> + /*
> + * Scan the whole domain, as 6.18 did. Do not cut the scan short with
> + * the SIS_UTIL nr_idle_scan hint: on a busy system the hint drops to a
> + * few CPUs, the scan then stops at whatever idle CPU it met first, and
> + * a task that fits no CPU (util above every capacity margin) lands on
> + * an idle little core while an idle big core is never looked at.
> + */
> for_each_cpu_wrap(cpu, cpus, target) {
> bool preferred_core = !has_idle_core || is_core_idle(cpu);
> unsigned long cpu_cap = capacity_of(cpu);
>
> - /*
> - * Stop when the nr_idle_scan is exhausted (mirrors
> - * select_idle_cpu() logic).
> - */
> - if (!has_idle_core && --nr <= 0)
> - return best_cpu;
> -
> if (!choose_idle_cpu(cpu, p))
> continue;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle
2026-11-24 15:18 ` Vincent Guittot
@ 2026-11-24 18:41 ` Christian Loehle
0 siblings, 0 replies; 8+ messages in thread
From: Christian Loehle @ 2026-11-24 18:41 UTC (permalink / raw)
To: Vincent Guittot, James Buck
Cc: K Prateek Nayak, Andrea Righi, Peter Zijlstra, Ingo Molnar,
Juri Lelli, Dietmar Eggemann, Valentin Schneider, linux-kernel,
regressions
On 11/24/26 15:18, Vincent Guittot wrote:
> On Tue, 24 Nov 2026 at 12:56, James Buck <jbuck2005.linux@outlook.com> wrote:
>>
>> Hi,
>>
>> Since commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()"), first in v7.2, CPU-bound multi-threaded work on my big.LITTLE arm64 board runs 12-19% slower than on v7.1 and earlier, because waking threads are placed on idle little CPUs while idle big CPUs are never looked at.
>>
>> Turning SIS_UTIL off at runtime restores the old speed. select_idle_capacity() and update_idle_cpu_scan() are unchanged in v7.4-rc4, so I expect mainline to behave the same.
>>
>> #regzbot introduced: 61ea17a63719
>>
>> System
>> ------
>> Orange Pi 6 (CIX CD8180 "Sky1"), 12 CPUs in five clusters, ACPI boot, no SMT:
>>
>> CPUs capacity
>> 0-1 1024
>> 2-5 279 (little)
>> 6-7 905
>> 8-9 866
>> 10-11 984
>>
>> The firmware's PPTT gives one MC domain over all 12 CPUs. It has SD_ASYM_CPUCAPACITY(_FULL) and SD_SHARE_LLC, with a CLS domain per cluster below it. The kernel is v7.3.5 plus the out-of-tree Sky1 SoC
>> driver patches the board needs to boot. None of them touch kernel/sched/; the only one in drivers/base/arch_topology.c adds a helper that updates capacity_freq_ref when boost is toggled.
>>
>> Workload
>> --------
>> llama.cpp llama-bench, Qwen2.5 1.5B Instruct Q4_K_M, CPU only, 8 threads, pp512 / tg128, tokens/s:
>>
>> 6.18.64 123.5 / 36.5
>> 7.3.5 109.0 / 29.5
>>
>> 7.3.5, taskset to the 8 big CPUs 121.4 / 34.7
>> 7.3.5, NO_SIS_UTIL at runtime 122.1 / 35.9
>> 7.3.5, patch below 121.7 / 35.7
>
> I have something similar on radxa O6 and 7.4-rc4 with latest tip/sched/core
> - 7.4-rc4+tip : 124.4
> - 7.4-rc4+tip NO_SIS_UTIL at runtime : 136.3
>
> I'm surprised that the newly_idle and/or periodic load balance doesn't
> pull the tasks earlier onto a mid/big core. It takes around 15/20ms to
> migrate a long-running thread to a bigger core when it runs on a
> little core whereas misfit should trigger an active load balance at
> next tick. I wonder if the Cluster level could slow down this
> migration.
I can reproduce the same on Pixel6 without any CLS, affecting CPU7 then.
The patch James posted it restores the good behavior and I currently don't
see a way to not do the full scan in select_idle_capacity().
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-11-25 14:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 11:56 [REGRESSION] sched/fair: SIS_UTIL limit in select_idle_capacity() leaves busy tasks on little CPUs while big CPUs are idle James Buck
2026-11-24 13:15 ` Andrea Righi
2026-11-25 2:53 ` K Prateek Nayak
2026-11-25 7:51 ` Vincent Guittot
2026-11-25 10:27 ` Chen Yu
2026-11-25 14:27 ` Vincent Guittot
2026-11-24 15:18 ` Vincent Guittot
2026-11-24 18:41 ` Christian Loehle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®