[PATCH 0/2] sched/fair: Randomize equally shallow idle CPU picks

Christian Loehle posted 2 patches 1 week, 1 day ago
There is a newer version of this series
kernel/sched/fair.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
[PATCH 0/2] sched/fair: Randomize equally shallow idle CPU picks
Posted by Christian Loehle 1 week, 1 day ago
Concurrent slow-path selectors can converge on the same idle CPU before
either task is enqueued. Remove the idle-recency preference and randomize
equal-latency choices in a single scan.

The testing platform 160-CPU, dual-socket Altra has unusually large 80-CPU
candidate groups at NUMA level, making this particularly prone to stale
idle picks.

Median stress-ng throughput (bogo ops/s):

  --fork  --fork-max      Baseline       Patched    Change
  ------------------------------------------------------
       1           1        779.19        811.38    +4.13%
       8           1       2958.32       2960.18    +0.06%
      16           1       5070.95       5247.63    +3.48%
      16           4       7692.64       7831.60    +1.81%
      32           1       8662.82       8643.39    -0.22%
      64           1      11880.47      12096.69    +1.82%

Separate instrumented runs observed lower conditional stale-pick rates,
i.e. a busy candidate at final return:

Workload                Baseline       Patched
----------------------------------------------
fork, 32 creators          0.771%       0.407%
fork, 64 creators          1.242%       0.672%

Christian Loehle (2):
  sched/fair: Drop idle recency from slow-path CPU selection
  sched/fair: Randomize equally shallow slow-path candidates

 kernel/sched/fair.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)


base-commit: fd73f4a6659897191fa0d40695fe370925dd3780
-- 
2.34.1
Re: [PATCH 0/2] sched/fair: Randomize equally shallow idle CPU picks
Posted by Muhammad Usama Anjum 16 hours ago
On 16/09/2026 11:01 am, Christian Loehle wrote:
> Concurrent slow-path selectors can converge on the same idle CPU before
> either task is enqueued. Remove the idle-recency preference and randomize
> equal-latency choices in a single scan.
> 
> The testing platform 160-CPU, dual-socket Altra has unusually large 80-CPU
> candidate groups at NUMA level, making this particularly prone to stale
> idle picks.
> 
> Median stress-ng throughput (bogo ops/s):
> 
>   --fork  --fork-max      Baseline       Patched    Change
>   ------------------------------------------------------
>        1           1        779.19        811.38    +4.13%
>        8           1       2958.32       2960.18    +0.06%
>       16           1       5070.95       5247.63    +3.48%
>       16           4       7692.64       7831.60    +1.81%
>       32           1       8662.82       8643.39    -0.22%
>       64           1      11880.47      12096.69    +1.82%
> 
> Separate instrumented runs observed lower conditional stale-pick rates,
> i.e. a busy candidate at final return:
> 
> Workload                Baseline       Patched
> ----------------------------------------------
> fork, 32 creators          0.771%       0.407%
> fork, 64 creators          1.242%       0.672%


Fastpath runs repeatable Linux kernel benchmarks. Higher is better; (I)
marks a statistically significant improvement, (R) a regression, and an
unmarked value no significant change. These comparisons use a zero noise
threshold and Fastpath's default 95% confidence interval.

Results for SUT Class aws-m7g.metal:
+---------------------------------+----------------------------------------+---------------------------------------------
| Benchmark                       | Result Class                           |   v7.3-rc4 (base) |   v7.3-rc4-chr-idle-v2 |
+=================================+========================================+=============================================
| repro-collection/mysql-workload | db transaction rate (transactions/min) |    244098.17      |        -0.02%          |
|                                 | new order rate (orders/min)            |     80570.33      |        -0.08%          |
+---------------------------------+----------------------------------------+---------------------------------------------

Results for SUT multi node aws-m7g.metal + m7gd.12xlarge: (Pleaes note that these two instances are not placed in a placement group so networking could be a bottleneck in this case.)
+---------------------------------+----------------------------------------+---------------------------------------------
| Benchmark                       | Result Class                           |   v7.3-rc4 (base) |   v7.3-rc4-chr-idle-v2 |
+=================================+========================================+=============================================
| repro-collection/mysql-workload | db transaction rate (transactions/min) |      231145.00    |           0.03%        |
|                                 | new order rate (orders/min)            |       76208.00    |           0.05%        |
+---------------------------------+----------------------------------------+---------------------------------------------

Hence:
Tested-by: Muhammad Usama Anjum <usama.anjum@arm.com>

> 
> Christian Loehle (2):
>   sched/fair: Drop idle recency from slow-path CPU selection
>   sched/fair: Randomize equally shallow slow-path candidates
> 
>  kernel/sched/fair.c | 24 ++++++++----------------
>  1 file changed, 8 insertions(+), 16 deletions(-)
> 
> 
> base-commit: fd73f4a6659897191fa0d40695fe370925dd3780


-- 
Thanks,
Usama