Revert "sched/fair: Add SIS_UTIL support to select_idle_capacity()"
Subsystems (2)
PATCH 1/1 Revert "sched/fair: Add SIS_UTIL support to select_idle_capacity()"
This reverts commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()").
That commit applied the SIS_UTIL scan budget to select_idle_capacity(). The early checks in select_idle_sibling() consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path calls select_idle_capacity() to search the allowed domain. With SIS_UTIL enabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Disabling SIS_UTIL reduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.
These measurements come from disabling SIS_UTIL on the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.
Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
--- kernel/sched/fair.c | 19 ------------------- 1 file changed, 19 deletions(-)
kernel/sched/fair.c +0 -19
@@ -9091,7 +9091,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);
@@ -9100,28 +9099,10 @@ 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 ; - } -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 ;
Signature · 1 line
2.53.1-Meta
Hi Usama,
Quoted 11 lines · Usama Arif
This reverts commit
61ea17a63719("sched/fair: AddSIS_UTILsupport toselect_idle_capacity()").That commit applied the
SIS_UTILscan budget toselect_idle_capacity(). The early checks inselect_idle_sibling()consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path callsselect_idle_capacity()to search the allowed domain. WithSIS_UTILenabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.
Isn't this consistent with select_idle_cpu(), which also skips the scan when the SIS_UTIL budget is zero? Missing an idle CPU is an intentional tradeoff of that heuristic. Could you clarify why we should remove the budget specifically from the asymmetric path?
Quoted 11 lines
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Have you tried forcing the symmetric idle-selection path through select_idle_cpu(), with SIS_UTIL both enabled and disabled?
It'd be useful to see whether disabling SIS_UTIL produces the same improvement there and whether symmetric idle selection performs better overall on this system.
Quoted 7 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.
Quoted 8 lines
These measurements come from disabling
SIS_UTILon the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
Yeah, this is my main concern, full scans can become quite expensive on large systems with lots of CPUs in the same LLC.
Thanks,
-Andrea
Quoted 54 lines
Reported-by Arnav Aghav <[email protected]>Fixes 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")Signed-off-by Usama Arif <[email protected]>--- kernel/sched/fair.c | 19 ------------------- 1 file changed, 19 deletions(-)kernel/sched/fair.c +0
-19@@ -9091,7 +9091,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);@@ -9100,28 +9099,10 @@ 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 ; - } -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 ;Signature · 1 line
2.53.1-Meta
Quoted 2 lines · On Fri, 13 Nov 2026 18:28:41 +0100 Andrea Righi <[email protected]> wrote:
Hi Usama,
Hello Andrea!
Quoted 13 lines · Usama Arif
Quoted 11 lines
This reverts commit
61ea17a63719("sched/fair: AddSIS_UTILsupport toselect_idle_capacity()").That commit applied the
SIS_UTILscan budget toselect_idle_capacity(). The early checks inselect_idle_sibling()consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path callsselect_idle_capacity()to search the allowed domain. WithSIS_UTILenabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.
Quoted 5 lines
Isn't this consistent with
select_idle_cpu(), which also skips the scan when theSIS_UTILbudget is zero? Missing an idle CPU is an intentional tradeoff of that heuristic. Could you clarify why we should remove the budget specifically from the asymmetric path?
It is consistent.
Symmetric path also has this (I didnt check this before sending the patch). The service is running on Grace servers which report capacity differences and updating the kernel from 6.16 resulted in the problem I outlined below.
Maybe the symmetric path needs to be audited as well?
Or maybe this service should not have ever run with SIS_UTIL at all.. (The only thing is that kernel upgrade caused a serious regression)
(Should have made this patch RFC :))
Quoted 12 lines
Quoted 11 lines
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Quoted 3 lines
Have you tried forcing the symmetric idle-selection path through
select_idle_cpu(), withSIS_UTILboth enabled and disabled?
This cant be done from a running kernel, right? My understanding is that the cpu capacities come from firmware, so cant be changed at runtime to be constant across all CPUs in kernel?
Changing kernel on a production service can be a bit of a process.
Quoted 15 lines
It'd be useful to see whether disabling
SIS_UTILproduces the same improvement there and whether symmetric idle selection performs better overall on this system.Quoted 11 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.These measurements come from disabling
SIS_UTILon the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.
Quoted 8 lines
Quoted 4 lines
Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
Yeah, this is my main concern, full scans can become quite expensive on large systems with lots of CPUs in the same LLC.
Yeah I imagine this was the reason for the initial patch.
The same workload on 6.16 kernel placed 69% of wakeups on an idle CPU, the affected kernel with the patch that this is reverting only placed 7%.
Do you know how much CPU usage can be attributed to the scan on these large systems if you do full scans?
Quoted 58 lines
Thanks,
-AndreaQuoted 54 lines
Reported-by Arnav Aghav <[email protected]>Fixes 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")Signed-off-by Usama Arif <[email protected]>--- kernel/sched/fair.c | 19 ------------------- 1 file changed, 19 deletions(-)kernel/sched/fair.c +0
-19@@ -9091,7 +9091,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);@@ -9100,28 +9099,10 @@ 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 ; - } -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 ;Signature · 1 line
2.53.1-Meta
Quoted 12 lines · Usama Arif
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences
(1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported
minute p50 latencies average 129 ms on the reference kernel and 223 ms
on the affected kernel.
Quoted 3 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s.
Afaik, the asymmetrical selection is supposed to solve a very specific problem: when a task requires X amount of CPU capacity to run, we try to avoid scheduling it on a CPU that has only a fraction of X available.
This creates the issue that a task that appears to "need" exactly X, because it's been running on a CPU with full available capacity, ends up not being scheduled at all when the available idle core has X-3% available capacity, because that CPU happens to spend 3% of its time handling interrupts, or running something else.
In that situation, it will be better to run the task on the CPU with 97% capacity right now, than to not run the task until a CPU frees up later.
Things like SMT and power-driven hardware scaling complicate the matter further, because we simply cannot see the full amount of capacity that is available on each CPU.
That makes me wonder if we should simply accept any CPU that's "close enough to X" when dealing with asymmetrical placement.
Say, anything that's above 3/4 of the capacity of X would be considered good enough to run the task.
That still prevents us from placing a CPU intensive task on a little core in a big.LITTLE system, or from placing a task on a CPU that spends 80% of its time handling interrupts, but it will allow a task to run right now, when the capacity imbalance is small.
Does that make sense, or am I forgetting something important?
Signature · 1 line
All Rights Reversed.
Quoted 55 lines · Usama Arif
Quoted 2 lines · On Fri, 13 Nov 2026 18:28:41 +0100 Andrea Righi <[email protected]> wrote:
Hi Usama,
Hello Andrea!
Quoted 13 lines · Usama Arif
Quoted 11 lines
This reverts commit
61ea17a63719("sched/fair: AddSIS_UTILsupport toselect_idle_capacity()").That commit applied the
SIS_UTILscan budget toselect_idle_capacity(). The early checks inselect_idle_sibling()consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path callsselect_idle_capacity()to search the allowed domain. WithSIS_UTILenabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.Quoted 5 lines
Isn't this consistent with
select_idle_cpu(), which also skips the scan when theSIS_UTILbudget is zero? Missing an idle CPU is an intentional tradeoff of that heuristic. Could you clarify why we should remove the budget specifically from the asymmetric path?It is consistent.
Symmetric path also has this (I didnt check this before sending the patch). The service is running on Grace servers which report capacity differences and updating the kernel from 6.16 resulted in the problem I outlined below.
Maybe the symmetric path needs to be audited as well?
Or maybe this service should not have ever run with
SIS_UTILat all.. (The only thing is that kernel upgrade caused a serious regression)(Should have made this patch RFC :))
Quoted 12 lines
Quoted 11 lines
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Quoted 3 lines
Have you tried forcing the symmetric idle-selection path through
select_idle_cpu(), withSIS_UTILboth enabled and disabled?
Quoted 5 lines
This cant be done from a running kernel, right? My understanding is that the cpu capacities come from firmware, so cant be changed at runtime to be constant across all CPUs in kernel?
Changing kernel on a production service can be a bit of a process.
Yeah, this would require a patch and a reboot. Unfortunately there isn't an existing runtime switch to force symmetric/asym idle selection.
Quoted 21 lines
Quoted 21 lines
It'd be useful to see whether disabling
SIS_UTILproduces the same improvement there and whether symmetric idle selection performs better overall on this system.Quoted 15 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.These measurements come from disabling
SIS_UTILon the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
Quoted 8 lines
Quoted 3 lines
Yeah, this is my main concern, full scans can become quite expensive on large systems with lots of CPUs in the same LLC.
Yeah I imagine this was the reason for the initial patch.
The same workload on 6.16 kernel placed 69% of wakeups on an idle CPU, the affected kernel with the patch that this is reverting only placed 7%.
That's a substantial difference, I agree the regression should be addressed. Perhaps this points to a limitation of the SIS_UTIL heuristic?
We could investigate incorporating observed idle CPU availability into the SIS_UTIL budget calculation, rather than relying solely on aggregate utilization. Periodic load balancing already collects idle CPU statistics, which might help distinguish actual saturation from high utilization with CPUs still available.
Prateek, do you have any thoughts on this? Do you see a way to improve SIS_UTIL for this workload while keeping the symmetric and asymmetric paths consistent?
Quoted 3 lines
Do you know how much CPU usage can be attributed to the scan on these large systems if you do full scans?
I don't have a measured CPU-cost figure for this case. My concern is the worst-case scan cost under frequent wakeups when few or no CPUs are idle.
Thanks,
-Andrea
Quoted 60 lines
Quoted 59 lines
Thanks,
-AndreaQuoted 54 lines
Reported-by Arnav Aghav <[email protected]>Fixes 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")Signed-off-by Usama Arif <[email protected]>--- kernel/sched/fair.c | 19 ------------------- 1 file changed, 19 deletions(-)kernel/sched/fair.c +0
-19@@ -9091,7 +9091,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);@@ -9100,28 +9099,10 @@ 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 ; - } -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 ;Signature · 1 line
2.53.1-Meta
Vincent Guittot
maintainerQuoted 24 lines · Rik van Riel
Quoted 12 lines · Usama Arif
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences
(1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported
minute p50 latencies average 129 ms on the reference kernel and 223 ms
on the affected kernel.Quoted 3 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s.Afaik, the asymmetrical selection is supposed to solve a very specific problem: when a task requires X amount of CPU capacity to run, we try to avoid scheduling it on a CPU that has only a fraction of X available.
Quoted 7 lines
This creates the issue that a task that appears to "need" exactly X, because it's been running on a CPU with full available capacity, ends up not being scheduled at all when the available idle core has X-3% available capacity, because that CPU happens to spend 3% of its time handling interrupts, or running something else.
The task will be scheduled on this idle cpu/core of (X-3% capacity) if no other idle CPU with X capacity is available.
The selection in select_idle_capacity is:
- Idle core with enough capacity
- Idle core with enough capacity but doesn't fullfill uclamp_min
- Idle core that doesn't fit
- Idle CPU with enough capacity
- Idle CPU with enough capacity but doesn't fullfill uclamp_min
- Idle CPU that doesn't fit
Quoted 29 lines
In that situation, it will be better to run the task on the CPU with 97% capacity right now, than to not run the task until a CPU frees up later.
Things like SMT and power-driven hardware scaling complicate the matter further, because we simply cannot see the full amount of capacity that is available on each CPU.
That makes me wonder if we should simply accept any CPU that's "close enough to X" when dealing with asymmetrical placement.
Say, anything that's above 3/4 of the capacity of X would be considered good enough to run the task.
That still prevents us from placing a CPU intensive task on a little core in a big.LITTLE system, or from placing a task on a CPU that spends 80% of its time handling interrupts, but it will allow a task to run right now, when the capacity imbalance is small.
Does that make sense, or am I forgetting something important?
--
All Rights Reversed.
Vincent Guittot
maintainerQuoted 100 lines · Andrea Righi
Quoted 55 lines · Usama Arif
Quoted 2 lines · On Fri, 13 Nov 2026 18:28:41 +0100 Andrea Righi <[email protected]> wrote:
Hi Usama,
Hello Andrea!
Quoted 13 lines · Usama Arif
Quoted 11 lines
This reverts commit
61ea17a63719("sched/fair: AddSIS_UTILsupport toselect_idle_capacity()").That commit applied the
SIS_UTILscan budget toselect_idle_capacity(). The early checks inselect_idle_sibling()consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path callsselect_idle_capacity()to search the allowed domain. WithSIS_UTILenabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.Quoted 5 lines
Isn't this consistent with
select_idle_cpu(), which also skips the scan when theSIS_UTILbudget is zero? Missing an idle CPU is an intentional tradeoff of that heuristic. Could you clarify why we should remove the budget specifically from the asymmetric path?It is consistent.
Symmetric path also has this (I didnt check this before sending the patch). The service is running on Grace servers which report capacity differences and updating the kernel from 6.16 resulted in the problem I outlined below.
Maybe the symmetric path needs to be audited as well?
Or maybe this service should not have ever run with
SIS_UTILat all.. (The only thing is that kernel upgrade caused a serious regression)(Should have made this patch RFC :))
Quoted 12 lines
Quoted 11 lines
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Quoted 3 lines
Have you tried forcing the symmetric idle-selection path through
select_idle_cpu(), withSIS_UTILboth enabled and disabled?Quoted 5 lines
This cant be done from a running kernel, right? My understanding is that the cpu capacities come from firmware, so cant be changed at runtime to be constant across all CPUs in kernel?
Changing kernel on a production service can be a bit of a process.
Yeah, this would require a patch and a reboot. Unfortunately there isn't an existing runtime switch to force symmetric/asym idle selection.
Quoted 21 lines
Quoted 21 lines
It'd be useful to see whether disabling
SIS_UTILproduces the same improvement there and whether symmetric idle selection performs better overall on this system.Quoted 15 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.These measurements come from disabling
SIS_UTILon the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
Quoted 8 lines
Quoted 3 lines
Yeah, this is my main concern, full scans can become quite expensive on large systems with lots of CPUs in the same LLC.
Yeah I imagine this was the reason for the initial patch.
The same workload on 6.16 kernel placed 69% of wakeups on an idle CPU, the affected kernel with the patch that this is reverting only placed 7%.
That's a substantial difference, I agree the regression should be addressed. Perhaps this points to a limitation of the
SIS_UTILheuristic?
Quoted 5 lines
We could investigate incorporating observed idle CPU availability into the
SIS_UTILbudget calculation, rather than relying solely on aggregate utilization. Periodic load balancing already collects idle CPU statistics, which might help distinguish actual saturation from high utilization with CPUs still available.
We want to keep same behavior for select_idle_cpu and select_idle_capacity with both using the same SIS_UTIL algorithm.
That being said, the current algorithm is probably a bit too cautious, particularly for systems with a small number of CPUs
And for a latency-sensitive workload, it would be good to consider setting a shorter slice to the latency sensistive task would run 1st even on a busy CPU
Quoted 76 lines
Prateek, do you have any thoughts on this? Do you see a way to improve
SIS_UTILfor this workload while keeping the symmetric and asymmetric paths consistent?Quoted 3 lines
Do you know how much CPU usage can be attributed to the scan on these large systems if you do full scans?
I don't have a measured CPU-cost figure for this case. My concern is the worst-case scan cost under frequent wakeups when few or no CPUs are idle.
Thanks,
-AndreaQuoted 60 lines
Quoted 59 lines
Thanks,
-AndreaQuoted 54 lines
Reported-by Arnav Aghav <[email protected]>Fixes 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")Signed-off-by Usama Arif <[email protected]>--- kernel/sched/fair.c | 19 ------------------- 1 file changed, 19 deletions(-)kernel/sched/fair.c +0
-20@@ -9091,7 +9091,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);@@ -9100,28 +9099,10 @@ 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 ; - } -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 ; --2.53.1-Meta
Quoted 33 lines · Vincent Guittot
Quoted 24 lines · Rik van Riel
Quoted 12 lines · Usama Arif
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences
(1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported
minute p50 latencies average 129 ms on the reference kernel and 223 ms
on the affected kernel.Quoted 3 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s.Afaik, the asymmetrical selection is supposed to solve a very specific problem: when a task requires X amount of CPU capacity to run, we try to avoid scheduling it on a CPU that has only a fraction of X available.
Quoted 7 lines
This creates the issue that a task that appears to "need" exactly X, because it's been running on a CPU with full available capacity, ends up not being scheduled at all when the available idle core has X-3% available capacity, because that CPU happens to spend 3% of its time handling interrupts, or running something else.
Quoted 9 lines
The task will be scheduled on this idle cpu/core of (X-3% capacity) if no other idle CPU with X capacity is available.
The selection inselect_idle_capacityis:
- Idle core with enough capacity
- Idle core with enough capacity but doesn't fullfilluclamp_min
- Idle core that doesn't fit
- Idle CPU with enough capacity
- Idle CPU with enough capacity but doesn't fullfilluclamp_min
- Idle CPU that doesn't fit
Right, and when the scan budget is exhausted select_idle_capacity() returns the best idle candidate found so far, even if it doesn't fit.
However, in the zero-budget case, we return before examining any candidates in the scan domain. Relaxing the capacity-fit rule inside that scan wouldn't change the outcome, because we never reach that check.
Maybe Rik's suggestion could instead help with the earlier checks in select_idle_sibling()? Accepting an idle target, previous or recently used CPU whose capacity is "close enough" could avoid reaching the zero-budget bailout.
The tradeoff is that we'd accept a potentially weaker CPU immediately, without searching for a better one.
Thanks,
-Andrea
Quoted 30 lines
Quoted 30 lines
In that situation, it will be better to run the task on the CPU with 97% capacity right now, than to not run the task until a CPU frees up later.
Things like SMT and power-driven hardware scaling complicate the matter further, because we simply cannot see the full amount of capacity that is available on each CPU.
That makes me wonder if we should simply accept any CPU that's "close enough to X" when dealing with asymmetrical placement.
Say, anything that's above 3/4 of the capacity of X would be considered good enough to run the task.
That still prevents us from placing a CPU intensive task on a little core in a big.LITTLE system, or from placing a task on a CPU that spends 80% of its time handling interrupts, but it will allow a task to run right now, when the capacity imbalance is small.
Does that make sense, or am I forgetting something important?
--
All Rights Reversed.
Quoted 64 lines · Andrea Righi
Date: Sat, 14 Nov 2026 10:11:03 +0100
From: Andrea Righi <[email protected]>
To: Vincent Guittot <[email protected]>
Cc: Rik van Riel <[email protected]>, Usama Arif <[email protected]>,
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], Arnav Aghav <[email protected]>
Subject: Re: [PATCH] Revert "sched/fair: AddSIS_UTILsupport to
select_idle_capacity()"Quoted 33 lines · Vincent Guittot
Quoted 24 lines · Rik van Riel
Quoted 12 lines · Usama Arif
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences
(1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported
minute p50 latencies average 129 ms on the reference kernel and 223 ms
on the affected kernel.Quoted 3 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s.Afaik, the asymmetrical selection is supposed to solve a very specific problem: when a task requires X amount of CPU capacity to run, we try to avoid scheduling it on a CPU that has only a fraction of X available.
Quoted 7 lines
This creates the issue that a task that appears to "need" exactly X, because it's been running on a CPU with full available capacity, ends up not being scheduled at all when the available idle core has X-3% available capacity, because that CPU happens to spend 3% of its time handling interrupts, or running something else.
Quoted 9 lines
The task will be scheduled on this idle cpu/core of (X-3% capacity) if no other idle CPU with X capacity is available.
The selection inselect_idle_capacityis:
- Idle core with enough capacity
- Idle core with enough capacity but doesn't fullfilluclamp_min
- Idle core that doesn't fit
- Idle CPU with enough capacity
- Idle CPU with enough capacity but doesn't fullfilluclamp_min
- Idle CPU that doesn't fitRight, and when the scan budget is exhausted
select_idle_capacity()returns the best idle candidate found so far, even if it doesn't fit.However, in the zero-budget case, we return before examining any candidates in the scan domain. Relaxing the capacity-fit rule inside that scan wouldn't change the outcome, because we never reach that check.
Quoted 8 lines
Maybe Rik's suggestion could instead help with the earlier checks in
select_idle_sibling()? Accepting an idle target, previous or recently used CPU whose capacity is "close enough" could avoid reaching the zero-budget bailout.The tradeoff is that we'd accept a potentially weaker CPU immediately, without searching for a better one.
Do you something similar to cluster wakeup, give the wakeup a second chance to find an idle CPU in the LLC. I suppose what you suggested is:
kernel/sched/fair.c +21 -2
@@ -9141,6 +9141,24 @@ static inline bool asym_fits_cpu(unsigned long util,return true; } +static int asym_idle_retry (struct task_struct *p,int prev,int target, +int recent) +{ +if (choose_idle_cpu (target, p)) +return target; + +if (prev != target &&cpus_share_cache (prev, target) && +choose_idle_cpu (prev, p)) +return prev; + +if (recent != prev && recent != target && +cpus_share_cache (recent, target) && +choose_idle_cpu (recent, p)) +return recent; + +return target; +} +/* * Try and locate an idle core/thread in the LLC cache domain. */
@@ -9149,7 +9167,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)bool has_idle_core = false;struct sched_domain *sd;unsigned long task_util, util_min, util_max; -int i, recent_used_cpu, prev_aff =-1 ; +int i, recent_used_cpu, recent, prev_aff =-1 ;/* * On asymmetric system, update task utilization because we will check
@@ -9206,6 +9224,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)/* Check a recently used CPU as a potential idle candidate: */ recent_used_cpu = p->recent_used_cpu; + recent = recent_used_cpu; p->recent_used_cpu = prev; if (recent_used_cpu != prev && recent_used_cpu != target &&
@@ -9244,7 +9263,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) target = i; goto select_smt_priority; } -return target; +return asym_idle_retry (p, prev, target, recent); } }
Signature · 1 line
2.43.0
Quoted 33 lines
Thanks,
-AndreaQuoted 30 lines
Quoted 30 lines
In that situation, it will be better to run the task on the CPU with 97% capacity right now, than to not run the task until a CPU frees up later.
Things like SMT and power-driven hardware scaling complicate the matter further, because we simply cannot see the full amount of capacity that is available on each CPU.
That makes me wonder if we should simply accept any CPU that's "close enough to X" when dealing with asymmetrical placement.
Say, anything that's above 3/4 of the capacity of X would be considered good enough to run the task.
That still prevents us from placing a CPU intensive task on a little core in a big.LITTLE system, or from placing a task on a CPU that spends 80% of its time handling interrupts, but it will allow a task to run right now, when the capacity imbalance is small.
Does that make sense, or am I forgetting something important?
--
All Rights Reversed.
Quoted 108 lines · Vincent Guittot
Quoted 100 lines · Andrea Righi
Quoted 55 lines · Usama Arif
Quoted 2 lines · On Fri, 13 Nov 2026 18:28:41 +0100 Andrea Righi <[email protected]> wrote:
Hi Usama,
Hello Andrea!
Quoted 13 lines · Usama Arif
Quoted 11 lines
This reverts commit
61ea17a63719("sched/fair: AddSIS_UTILsupport toselect_idle_capacity()").That commit applied the
SIS_UTILscan budget toselect_idle_capacity(). The early checks inselect_idle_sibling()consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path callsselect_idle_capacity()to search the allowed domain. WithSIS_UTILenabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.Quoted 5 lines
Isn't this consistent with
select_idle_cpu(), which also skips the scan when theSIS_UTILbudget is zero? Missing an idle CPU is an intentional tradeoff of that heuristic. Could you clarify why we should remove the budget specifically from the asymmetric path?It is consistent.
Symmetric path also has this (I didnt check this before sending the patch). The service is running on Grace servers which report capacity differences and updating the kernel from 6.16 resulted in the problem I outlined below.
Maybe the symmetric path needs to be audited as well?
Or maybe this service should not have ever run with
SIS_UTILat all.. (The only thing is that kernel upgrade caused a serious regression)(Should have made this patch RFC :))
Quoted 12 lines
Quoted 11 lines
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Quoted 3 lines
Have you tried forcing the symmetric idle-selection path through
select_idle_cpu(), withSIS_UTILboth enabled and disabled?Quoted 5 lines
This cant be done from a running kernel, right? My understanding is that the cpu capacities come from firmware, so cant be changed at runtime to be constant across all CPUs in kernel?
Changing kernel on a production service can be a bit of a process.
Yeah, this would require a patch and a reboot. Unfortunately there isn't an existing runtime switch to force symmetric/asym idle selection.
Quoted 21 lines
Quoted 21 lines
It'd be useful to see whether disabling
SIS_UTILproduces the same improvement there and whether symmetric idle selection performs better overall on this system.Quoted 15 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.These measurements come from disabling
SIS_UTILon the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
Quoted 8 lines
Quoted 3 lines
Yeah, this is my main concern, full scans can become quite expensive on large systems with lots of CPUs in the same LLC.
Yeah I imagine this was the reason for the initial patch.
The same workload on 6.16 kernel placed 69% of wakeups on an idle CPU, the affected kernel with the patch that this is reverting only placed 7%.
That's a substantial difference, I agree the regression should be addressed. Perhaps this points to a limitation of the
SIS_UTILheuristic?Quoted 5 lines
We could investigate incorporating observed idle CPU availability into the
SIS_UTILbudget calculation, rather than relying solely on aggregate utilization. Periodic load balancing already collects idle CPU statistics, which might help distinguish actual saturation from high utilization with CPUs still available.
Quoted 6 lines
We want to keep same behavior for
select_idle_cpuandselect_idle_capacitywith both using the sameSIS_UTILalgorithm.That being said, the current algorithm is probably a bit too cautious, particularly for systems with a small number of CPUs
OK, maybe we can scale the minimal scan number according to the number of CPUs in an LLC, the smaller the LLC, the more CPUs should be scanned, and vice versa. This "minimal scan guarantee" was once in SIS_PROP, which is 4 IIUC. Now we can make it triggered when there are idle CPUs in the domain, per Andrea:
"We could investigate incorporating observed idle CPU availability into
the SIS_UTIL budget calculation, rather than relying solely on aggregate utilization."
scale by 256 / llc_weight, Grace would have to scan at least 3 CPUs, not sure if it works for Usama
LLC CPUs nr_min
8 8
16 16
32 8 64 4 72 3 Grace 128 2 256 1 512 0
kernel/sched/fair.c +10 -2
@@ -12890,7 +12890,8 @@ sched_balance_find_dst_group(struct sched_domain *sd, struct task_struct *p, int }static void update_idle_cpu_scan (struct lb_env *env, -unsigned long sum_util) +unsigned long sum_util, +bool has_idle_cpus) {struct sched_domain_shared *sd_share;struct sched_domain *sd = env->sd;
@@ -12954,6 +12955,11 @@ static void update_idle_cpu_scan(struct lb_env *env,/* equation [2] */ y *= llc_weight;do_div (y,SCHED_CAPACITY_SCALE ); + +/* scale the minimal scan number for small LLC */ +if (has_idle_cpus) + y =max_t (u64, y,min (llc_weight,256 / llc_weight)); +if ((int )y != sd_share->nr_idle_scan)WRITE_ONCE (sd_share->nr_idle_scan, (int )y); }
@@ -12970,6 +12976,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sdstruct sg_lb_stats *local = &sds->local_stat;struct sg_lb_stats tmp_sgs;unsigned long sum_util =0 ; +unsigned int nr_idle_cpus =0 ;bool sg_overloaded =0 , sg_overutilized =0 ; env->dst_core_idle = !sched_smt_active () ||is_core_idle (env->dst_cpu);
@@ -13002,6 +13009,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd sds->total_capacity += sgs->group_capacity; sum_util += sgs->group_util; + nr_idle_cpus += sgs->idle_cpus; sg = sg->next; }while (sg != env->sd->groups);
@@ -13027,7 +13035,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sdset_rd_overutilized (env->dst_rq->rd, sg_overutilized); } -update_idle_cpu_scan (env, sum_util); +update_idle_cpu_scan (env, sum_util, nr_idle_cpus >0 ); }/**
Signature · 1 line
2.43.0
Quoted 4 lines
And for a latency-sensitive workload, it would be good to consider setting a shorter slice to the latency sensistive task would run 1st even on a busy CPU
Yes, and a short slice task will be pushed to another CPU if it is waiting on the runqueue.
thanks,
Chenyu
Vincent Guittot
maintainerQuoted 117 lines · Chen Yu
Quoted 108 lines · Vincent Guittot
Quoted 100 lines · Andrea Righi
Quoted 55 lines · Usama Arif
Quoted 2 lines · On Fri, 13 Nov 2026 18:28:41 +0100 Andrea Righi <[email protected]> wrote:
Hi Usama,
Hello Andrea!
Quoted 13 lines · Usama Arif
Quoted 11 lines
This reverts commit
61ea17a63719("sched/fair: AddSIS_UTILsupport toselect_idle_capacity()").That commit applied the
SIS_UTILscan budget toselect_idle_capacity(). The early checks inselect_idle_sibling()consider a few specific
candidates: the target, previous and recently used CPUs. If none is selected, the asymmetric path callsselect_idle_capacity()to search the allowed domain. WithSIS_UTILenabled, a zero scan budget makes it return -1 before that search. The caller then returns the selected target, even if an unexamined CPU in the domain is idle and fits the task.Quoted 5 lines
Isn't this consistent with
select_idle_cpu(), which also skips the scan when theSIS_UTILbudget is zero? Missing an idle CPU is an intentional tradeoff of that heuristic. Could you clarify why we should remove the budget specifically from the asymmetric path?It is consistent.
Symmetric path also has this (I didnt check this before sending the patch). The service is running on Grace servers which report capacity differences and updating the kernel from 6.16 resulted in the problem I outlined below.
Maybe the symmetric path needs to be audited as well?
Or maybe this service should not have ever run with
SIS_UTILat all.. (The only thing is that kernel upgrade caused a serious regression)(Should have made this patch RFC :))
Quoted 12 lines
Quoted 11 lines
The budget is derived from aggregate CFS utilization. High aggregate utilization can coexist with idle CPUs when a task wakes.
On a 72-CPU NVIDIA grace arm64 server, small reported capacity differences (1013-1024) within the single LLC activate asymmetric selection. Both the reference and affected kernels were observed with a zero scan hint. The reference kernel ignored it and still searched the domain. A latency-sensitive, wakeup-heavy production workload saw its reported minute p50 latencies average 129 ms on the reference kernel and 223 ms on the affected kernel.
Quoted 3 lines
Have you tried forcing the symmetric idle-selection path through
select_idle_cpu(), withSIS_UTILboth enabled and disabled?Quoted 5 lines
This cant be done from a running kernel, right? My understanding is that the cpu capacities come from firmware, so cant be changed at runtime to be constant across all CPUs in kernel?
Changing kernel on a production service can be a bit of a process.
Yeah, this would require a patch and a reboot. Unfortunately there isn't an existing runtime switch to force symmetric/asym idle selection.
Quoted 21 lines
Quoted 21 lines
It'd be useful to see whether disabling
SIS_UTILproduces the same improvement there and whether symmetric idle selection performs better overall on this system.Quoted 15 lines
Disabling
SIS_UTILreduced the aggregate involuntary context switch rate of worker main threads from 71.6k/s to 13.3k/s; re-enabling it raised the rate to 73.7k/s. A five-minute disabled run also reduced kernel CPU time per request by 10.9%. The available minute p50 samples averaged 149 ms, compared with 241 ms before the trial.These measurements come from disabling
SIS_UTILon the installed kernel. The feature toggle also disables the symmetric scan limit and shared scan-hint updates.Restore the search of the allowed domain, retaining the capacity, uclamp and SMT selection rules and their early returns. Domains with no suitable idle CPU can again require a full scan, potentially increasing scan CPU cost.
Quoted 8 lines
Quoted 3 lines
Yeah, this is my main concern, full scans can become quite expensive on large systems with lots of CPUs in the same LLC.
Yeah I imagine this was the reason for the initial patch.
The same workload on 6.16 kernel placed 69% of wakeups on an idle CPU, the affected kernel with the patch that this is reverting only placed 7%.
That's a substantial difference, I agree the regression should be addressed. Perhaps this points to a limitation of the
SIS_UTILheuristic?Quoted 5 lines
We could investigate incorporating observed idle CPU availability into the
SIS_UTILbudget calculation, rather than relying solely on aggregate utilization. Periodic load balancing already collects idle CPU statistics, which might help distinguish actual saturation from high utilization with CPUs still available.Quoted 6 lines
We want to keep same behavior for
select_idle_cpuandselect_idle_capacitywith both using the sameSIS_UTILalgorithm.That being said, the current algorithm is probably a bit too cautious, particularly for systems with a small number of CPUs
Quoted 7 lines
OK, maybe we can scale the minimal scan number according to the number of CPUs in an LLC, the smaller the LLC, the more CPUs should be scanned, and vice versa. This "minimal scan guarantee" was once in
SIS_PROP, which is 4 IIUC. Now we can make it triggered when there are idle CPUs in the domain, per Andrea:
"We could investigate incorporating observed idle CPU availability into
theSIS_UTILbudget calculation, rather than relying solely on aggregate utilization."
Sorry for the late reply, your email was lost in my inbox.
Quoted 7 lines
scale by 256 /
llc_weight, Grace would have to scan at least 3 CPUs, not sure if it works for UsamaLLC CPUs
nr_min
8 8
16 16
Quoted 6 lines
32 8 64 4 72 3 Grace 128 2 256 1 512 0
Or maybe just having a floor value of 4 or 3 which gives a fixed overhead when util_avg says that the system is overloaded. On a 4 CPUs, if you have 3 CPUs fully busy and 1 fully idle cpu, you will try to find a CPU. The same on 8 CPUs. On 72 CPUS, you will try even one loop if you have 62 CPUs fully busy.
An on top of that, util_est exacerbs the effect because it sums the max of all tasks which is always higher than CPU's utilization. (For this one I have a patch to keep util_est for sched_util governor but remove it when evaluating system utilization
Quoted 66 lines
kernel/sched/fair.c +10
-3@@ -12890,7 +12890,8 @@ sched_balance_find_dst_group(struct sched_domain *sd, struct task_struct *p, int }static void update_idle_cpu_scan (struct lb_env *env, -unsigned long sum_util) +unsigned long sum_util, +bool has_idle_cpus) {struct sched_domain_shared *sd_share;struct sched_domain *sd = env->sd;@@ -12954,6 +12955,11 @@ static void update_idle_cpu_scan(struct lb_env *env,/* equation [2] */ y *= llc_weight;do_div (y,SCHED_CAPACITY_SCALE ); + +/* scale the minimal scan number for small LLC */ +if (has_idle_cpus) + y =max_t (u64, y,min (llc_weight,256 / llc_weight)); +if ((int )y != sd_share->nr_idle_scan)WRITE_ONCE (sd_share->nr_idle_scan, (int )y); }@@ -12970,6 +12976,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sdstruct sg_lb_stats *local = &sds->local_stat;struct sg_lb_stats tmp_sgs;unsigned long sum_util =0 ; +unsigned int nr_idle_cpus =0 ;bool sg_overloaded =0 , sg_overutilized =0 ; env->dst_core_idle = !sched_smt_active () ||is_core_idle (env->dst_cpu);@@ -13002,6 +13009,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd sds->total_capacity += sgs->group_capacity; sum_util += sgs->group_util; + nr_idle_cpus += sgs->idle_cpus; sg = sg->next; }while (sg != env->sd->groups);@@ -13027,7 +13035,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sdset_rd_overutilized (env->dst_rq->rd, sg_overutilized); } -update_idle_cpu_scan (env, sum_util); +update_idle_cpu_scan (env, sum_util, nr_idle_cpus >0 ); }/** -- 2.43.0
Quoted 4 lines
And for a latency-sensitive workload, it would be good to consider setting a shorter slice to the latency sensistive task would run 1st even on a busy CPU
Yes, and a short slice task will be pushed to another CPU if it is waiting on the runqueue.
thanks,
Chenyu