The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
@ 2026-11-30  8:16 Chen Yu
  2026-11-30  9:20 ` Andrea Righi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chen Yu @ 2026-11-30  8:16 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: K Prateek Nayak, Vincent Guittot, Andrea Righi, Christian Loehle,
	James Buck, Usama Arif, Tim Chen, linux-kernel, Chen Yu

It was reported that scanning more CPUs on a system with a small LLC
benefits the workload more than limiting the scan depth, because
scanning more CPUs does not cost much and work conservation is
preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
to select_idle_capacity()"), James reported that one CPU-bound
multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
impacted a little bit.

Expand the scan depth so that systems with fewer than 32 CPUs per LLC
behave like a 32-CPU system. This way, the scan number can be scaled up
for such small systems.

The effect is as below:
nr_idle_scan before -> after the patch
(LLC = 8, 12 and 16 CPUs for example)
Cell format: util_sum : nr_scan before -> after
Util% = util_sum / (llc_weight * 1024)

  Util% | LLC=8            | LLC=12           | LLC=16
  ------+------------------+------------------+------------------
   10%  |   819 :  7 ->  8 |  1228 : 11 -> 12 |  1638 : 15 -> 16
   20%  |  1638 :  7 ->  8 |  2457 : 11 -> 12 |  3276 : 15 -> 16
   30%  |  2457 :  7 ->  8 |  3686 : 10 -> 12 |  4915 : 14 -> 16
   40%  |  3276 :  6 ->  8 |  4915 :  9 -> 12 |  6553 : 12 -> 16
   50%  |  4096 :  5 ->  8 |  6144 :  7 -> 12 |  8192 : 10 -> 16
   55%  |  4505 :  4 ->  8 |  6758 :  7 -> 12 |  9011 :  9 -> 16
   60%  |  4915 :  4 ->  8 |  7372 :  6 -> 12 |  9830 :  8 -> 16
   65%  |  5324 :  3 ->  8 |  7987 :  5 -> 12 | 10649 :  6 -> 13
   70%  |  5734 :  2 ->  8 |  8601 :  3 -> 10 | 11468 :  5 -> 10
   75%  |  6144 :  1 ->  7 |  9216 :  2 ->  7 | 12288 :  3 ->  7
   80%  |  6553 :  1 ->  4 |  9830 :  1 ->  4 | 13107 :  2 ->  4
   82%  |  6717 :  0 ->  2 | 10076 :  0 ->  2 | 13434 :  1 ->  2
   84%  |  6881 :  0 ->  1 | 10321 :  0 ->  1 | 13762 :  0 ->  1
   85%  |  6963 :  0 ->  0 | 10444 :  0 ->  0 | 13926 :  0 ->  0
   86%  |  7045 :  0 ->  0 | 10567 :  0 ->  0 | 14090 :  0 ->  0

With this change, the regression was gone on Orange Pi 6 and Radxa O6.
However, this change can not deal with the performance regression on
Usama's 72-CPU NVIDIA Grace arm64 server. More investigation needs to
be carried out for the large asymmetric CPU system [1], considering the
number of idle CPUs besides the utilization in SIS_UTIL, e.g.

Since Intel servers usually have >= 32 CPUs per LLC, this change does
not impact Intel servers much. AMD servers have 16 CPUs per CCX, testing
on AMD Milan showed no significant difference on redis/mysql, and a slight
improvement on hackbench/schbench:

  =========================================
  hackbench threads+pipe
    num_runs:      5
    host:          AMD-Milan
    kernel:        7.4.0-rc4-sis-patched+
  =========================================
  G   FD  | baseline s/se% | patched s/se%  | SPEEDUP | RESULT
  ------------------------------------------------------------------
  1   1   |   6.352/ 7.57% |   5.680/ 5.74% |   1.12x | noise
  1   2   |   6.225/ 8.75% |   5.624/ 7.27% |   1.11x | noise
  1   4   |   8.834/10.23% |   8.799/10.24% |   1.00x | noise
  1   8   |   4.833/ 1.70% |   5.060/ 1.72% |   0.96x | noise
  1   16  |   5.471/ 1.61% |   5.551/ 0.60% |   0.99x | noise
  1   20  |   5.220/ 1.17% |   5.298/ 0.82% |   0.99x | noise
  2   1   |   5.558/ 6.23% |   6.114/ 8.63% |   0.91x | noise
  2   2   |   8.056/10.44% |   8.029/12.53% |   1.00x | noise
  2   4   |   5.292/ 1.26% |   5.152/ 1.89% |   1.03x | noise
  2   8   |   5.493/ 2.15% |   5.403/ 3.38% |   1.02x | noise
  2   16  |   5.557/ 1.68% |   5.407/ 0.88% |   1.03x | noise
  2   20  |   5.224/ 0.68% |   5.341/ 1.19% |   0.98x | noise
  4   1   |   6.047/ 2.89% |   5.797/ 4.41% |   1.04x | noise
  4   2   |   5.597/ 2.19% |   5.791/ 1.77% |   0.97x | noise
  4   4   |   5.397/ 1.62% |   5.501/ 1.18% |   0.98x | noise
  4   8   |   5.468/ 2.67% |   5.155/ 0.95% |   1.06x | IMPROVED
  4   16  |   5.989/ 3.31% |   5.507/ 1.36% |   1.09x | IMPROVED
  4   20  |   5.267/ 0.79% |   5.101/ 0.60% |   1.03x | IMPROVED
  8   1   |   5.322/ 3.12% |   5.273/ 1.96% |   1.01x | noise
  8   2   |   5.531/ 2.38% |   5.367/ 1.64% |   1.03x | noise
  8   4   |   5.672/ 0.70% |   5.814/ 2.60% |   0.98x | noise
  8   8   |   5.037/ 0.93% |   5.100/ 0.97% |   0.99x | noise
  8   16  |   5.455/ 0.45% |   5.290/ 0.39% |   1.03x | IMPROVED
  8   20  |   5.388/ 0.36% |   5.285/ 0.18% |   1.02x | IMPROVED
  16  1   |   5.519/ 2.49% |   5.296/ 2.10% |   1.04x | noise
  16  2   |   5.398/ 0.77% |   5.503/ 3.05% |   0.98x | noise
  16  4   |   5.274/ 1.72% |   5.363/ 1.72% |   0.98x | noise
  16  8   |   5.416/ 0.37% |   5.185/ 0.20% |   1.04x | IMPROVED
  16  16  |   5.596/ 0.41% |   5.337/ 0.24% |   1.05x | IMPROVED
  16  20  |   5.292/ 0.88% |   5.076/ 0.55% |   1.04x | IMPROVED

  redis (redis-benchmark -t set)
  =========================================
  THR | baseline rps/se% | patched rps/se% | SPEEDUP | p99 ms b/p  | RESULT
  -----------------------------------------------------------------------
  4   |  1492165/ 0.76% |  1480823/ 0.00% |  0.992x | 0.541 0.546 | noise
  8   |  1665556/ 0.01% |  1665501/ 0.00% |  1.000x | 0.490 0.489 | noise
  16  |   984279/ 0.60% |   974545/ 0.00% |  0.990x | 1.124 1.109 | noise
  32  |   887091/ 0.01% |   883212/ 0.44% |  0.996x | 1.713 1.721 | noise

  mysql
  =========================================
  THR  | baseline tps/se% | patched tps/se% | SPEEDUP | p95 ms b/p | RESULT
  -----------------------------------------------------------------------
  8    |   151897/ 0.76% |   152428/ 0.54% |  1.003x | 0.07 0.08 | noise
  16   |   294014/ 0.59% |   296699/ 0.28% |  1.009x | 0.07 0.07 | noise
  32   |   386817/ 2.18% |   377835/ 0.31% |  0.977x | 0.09 0.09 | noise
  64   |   560950/16.97% |   481494/ 5.68% |  0.858x | 0.19 0.23 | noise
  128  |   752079/ 4.92% |   729685/ 3.89% |  0.970x | 0.36 0.38 | noise
  256  |   772771/ 0.62% |   771630/ 0.21% |  0.999x | 0.79 0.78 | noise

  schbench
  =========================================
  T   WRK  METRIC   | baseline/se%   | patched/se%    | SPEEDUP | RESULT
  -----------------------------------------------------------------------
  2   8    rps      |  1683.8/ 0.04% |  1681.3/ 0.10% |  0.999x | noise
  2   8    wake_p99 |    10.2/ 1.96% |     9.8/ 3.82% |  1.041x | noise
  2   8    req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
  4   16   rps      |  3369.0/ 0.03% |  3353.9/ 0.44% |  0.996x | noise
  4   16   wake_p99 |    10.0/ 0.00% |    10.0/ 0.00% |  1.000x | noise
  4   16   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
  8   32   rps      |  6724.6/ 0.04% |  6722.0/ 0.16% |  1.000x | noise
  8   32   wake_p99 |     9.8/ 2.04% |    10.0/ 0.00% |  0.980x | noise
  8   32   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
  16  64   rps      | 10933.0/ 4.10% | 11179.8/ 1.80% |  1.023x | noise
  16  64   wake_p99 |    12.0/ 0.00% |    12.0/ 0.00% |  1.000x | noise
  16  64   req_p99  | 10051.2/ 0.13% | 10051.2/ 0.08% |  1.000x | noise
  24  96   rps      | 12970.1/ 0.22% | 12971.0/ 0.48% |  1.000x | noise
  24  96   wake_p99 |    13.4/ 3.81% |    12.4/ 1.98% |  1.081x | noise
  24  96   req_p99  | 10179.2/ 0.21% | 10185.6/ 0.21% |  0.999x | noise
  32  128  rps      | 12613.1/ 0.09% | 12667.2/ 0.11% |  1.004x | IMPROVED
  32  128  wake_p99 |    37.2/ 3.55% |    34.2/ 1.43% |  1.088x | IMPROVED
  32  128  req_p99  | 10467.2/ 0.59% | 10358.4/ 0.06% |  1.011x | noise

Link: https://lore.kernel.org/all/20261113153157.2495664-1-usama.arif@linux.dev/ #1

Fixes: 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")
Reported-by: James Buck <jbuck2005.linux@outlook.com>
Closes: https://lore.kernel.org/lkml/CY5P221MB09262B7D6A68954CC1B3199FBD442@CY5P221MB0926.NAMP221.PROD.OUTLOOK.COM/
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: James Buck <jbuck2005.linux@outlook.com>
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
---
 kernel/sched/fair.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index da0d9e19c457..15ddfce49cb7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12936,9 +12936,16 @@ static void update_idle_cpu_scan(struct lb_env *env,
 	tmp = min_t(long, tmp, SCHED_CAPACITY_SCALE);
 	y = SCHED_CAPACITY_SCALE - tmp;
 
-	/* equation [2] */
-	y *= llc_weight;
+	/*
+	 * equation [2]
+	 * Scanning a small LLC is cheap, work conservation is
+	 * preferred over limiting the scan depth. Treat a small
+	 * LLC as if it had 32 CPUs, then the number of CPUs suggested
+	 * by SIS_UTIL is scaled up for small LLCs.
+	 */
+	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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
  2026-11-30  8:16 [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system Chen Yu
@ 2026-11-30  9:20 ` Andrea Righi
  2026-12-01 13:25   ` Chen Yu
  2026-11-30 10:28 ` K Prateek Nayak
  2026-12-01  8:29 ` Li kunyu
  2 siblings, 1 reply; 7+ messages in thread
From: Andrea Righi @ 2026-11-30  9:20 UTC (permalink / raw)
  To: Chen Yu
  Cc: Peter Zijlstra, Ingo Molnar, K Prateek Nayak, Vincent Guittot,
	Christian Loehle, James Buck, Usama Arif, Tim Chen, linux-kernel

Hello,

On Mon, Nov 30, 2026 at 04:16:07PM +0800, Chen Yu wrote:
> It was reported that scanning more CPUs on a system with a small LLC
> benefits the workload more than limiting the scan depth, because
> scanning more CPUs does not cost much and work conservation is
> preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
> to select_idle_capacity()"), James reported that one CPU-bound
> multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
> impacted a little bit.
> 
> Expand the scan depth so that systems with fewer than 32 CPUs per LLC
> behave like a 32-CPU system. This way, the scan number can be scaled up
> for such small systems.
> 
> The effect is as below:
> nr_idle_scan before -> after the patch
> (LLC = 8, 12 and 16 CPUs for example)
> Cell format: util_sum : nr_scan before -> after
> Util% = util_sum / (llc_weight * 1024)
> 
>   Util% | LLC=8            | LLC=12           | LLC=16
>   ------+------------------+------------------+------------------
>    10%  |   819 :  7 ->  8 |  1228 : 11 -> 12 |  1638 : 15 -> 16
>    20%  |  1638 :  7 ->  8 |  2457 : 11 -> 12 |  3276 : 15 -> 16
>    30%  |  2457 :  7 ->  8 |  3686 : 10 -> 12 |  4915 : 14 -> 16
>    40%  |  3276 :  6 ->  8 |  4915 :  9 -> 12 |  6553 : 12 -> 16
>    50%  |  4096 :  5 ->  8 |  6144 :  7 -> 12 |  8192 : 10 -> 16
>    55%  |  4505 :  4 ->  8 |  6758 :  7 -> 12 |  9011 :  9 -> 16
>    60%  |  4915 :  4 ->  8 |  7372 :  6 -> 12 |  9830 :  8 -> 16
>    65%  |  5324 :  3 ->  8 |  7987 :  5 -> 12 | 10649 :  6 -> 13
>    70%  |  5734 :  2 ->  8 |  8601 :  3 -> 10 | 11468 :  5 -> 10
>    75%  |  6144 :  1 ->  7 |  9216 :  2 ->  7 | 12288 :  3 ->  7
>    80%  |  6553 :  1 ->  4 |  9830 :  1 ->  4 | 13107 :  2 ->  4
>    82%  |  6717 :  0 ->  2 | 10076 :  0 ->  2 | 13434 :  1 ->  2
>    84%  |  6881 :  0 ->  1 | 10321 :  0 ->  1 | 13762 :  0 ->  1
>    85%  |  6963 :  0 ->  0 | 10444 :  0 ->  0 | 13926 :  0 ->  0
>    86%  |  7045 :  0 ->  0 | 10567 :  0 ->  0 | 14090 :  0 ->  0
> 
> With this change, the regression was gone on Orange Pi 6 and Radxa O6.
> However, this change can not deal with the performance regression on
> Usama's 72-CPU NVIDIA Grace arm64 server. More investigation needs to
> be carried out for the large asymmetric CPU system [1], considering the
> number of idle CPUs besides the utilization in SIS_UTIL, e.g.
> 
> Since Intel servers usually have >= 32 CPUs per LLC, this change does
> not impact Intel servers much. AMD servers have 16 CPUs per CCX, testing
> on AMD Milan showed no significant difference on redis/mysql, and a slight
> improvement on hackbench/schbench:
> 
>   =========================================
>   hackbench threads+pipe
>     num_runs:      5
>     host:          AMD-Milan
>     kernel:        7.4.0-rc4-sis-patched+
>   =========================================
>   G   FD  | baseline s/se% | patched s/se%  | SPEEDUP | RESULT
>   ------------------------------------------------------------------
>   1   1   |   6.352/ 7.57% |   5.680/ 5.74% |   1.12x | noise
>   1   2   |   6.225/ 8.75% |   5.624/ 7.27% |   1.11x | noise
>   1   4   |   8.834/10.23% |   8.799/10.24% |   1.00x | noise
>   1   8   |   4.833/ 1.70% |   5.060/ 1.72% |   0.96x | noise
>   1   16  |   5.471/ 1.61% |   5.551/ 0.60% |   0.99x | noise
>   1   20  |   5.220/ 1.17% |   5.298/ 0.82% |   0.99x | noise
>   2   1   |   5.558/ 6.23% |   6.114/ 8.63% |   0.91x | noise
>   2   2   |   8.056/10.44% |   8.029/12.53% |   1.00x | noise
>   2   4   |   5.292/ 1.26% |   5.152/ 1.89% |   1.03x | noise
>   2   8   |   5.493/ 2.15% |   5.403/ 3.38% |   1.02x | noise
>   2   16  |   5.557/ 1.68% |   5.407/ 0.88% |   1.03x | noise
>   2   20  |   5.224/ 0.68% |   5.341/ 1.19% |   0.98x | noise
>   4   1   |   6.047/ 2.89% |   5.797/ 4.41% |   1.04x | noise
>   4   2   |   5.597/ 2.19% |   5.791/ 1.77% |   0.97x | noise
>   4   4   |   5.397/ 1.62% |   5.501/ 1.18% |   0.98x | noise
>   4   8   |   5.468/ 2.67% |   5.155/ 0.95% |   1.06x | IMPROVED
>   4   16  |   5.989/ 3.31% |   5.507/ 1.36% |   1.09x | IMPROVED
>   4   20  |   5.267/ 0.79% |   5.101/ 0.60% |   1.03x | IMPROVED
>   8   1   |   5.322/ 3.12% |   5.273/ 1.96% |   1.01x | noise
>   8   2   |   5.531/ 2.38% |   5.367/ 1.64% |   1.03x | noise
>   8   4   |   5.672/ 0.70% |   5.814/ 2.60% |   0.98x | noise
>   8   8   |   5.037/ 0.93% |   5.100/ 0.97% |   0.99x | noise
>   8   16  |   5.455/ 0.45% |   5.290/ 0.39% |   1.03x | IMPROVED
>   8   20  |   5.388/ 0.36% |   5.285/ 0.18% |   1.02x | IMPROVED
>   16  1   |   5.519/ 2.49% |   5.296/ 2.10% |   1.04x | noise
>   16  2   |   5.398/ 0.77% |   5.503/ 3.05% |   0.98x | noise
>   16  4   |   5.274/ 1.72% |   5.363/ 1.72% |   0.98x | noise
>   16  8   |   5.416/ 0.37% |   5.185/ 0.20% |   1.04x | IMPROVED
>   16  16  |   5.596/ 0.41% |   5.337/ 0.24% |   1.05x | IMPROVED
>   16  20  |   5.292/ 0.88% |   5.076/ 0.55% |   1.04x | IMPROVED
> 
>   redis (redis-benchmark -t set)
>   =========================================
>   THR | baseline rps/se% | patched rps/se% | SPEEDUP | p99 ms b/p  | RESULT
>   -----------------------------------------------------------------------
>   4   |  1492165/ 0.76% |  1480823/ 0.00% |  0.992x | 0.541 0.546 | noise
>   8   |  1665556/ 0.01% |  1665501/ 0.00% |  1.000x | 0.490 0.489 | noise
>   16  |   984279/ 0.60% |   974545/ 0.00% |  0.990x | 1.124 1.109 | noise
>   32  |   887091/ 0.01% |   883212/ 0.44% |  0.996x | 1.713 1.721 | noise
> 
>   mysql
>   =========================================
>   THR  | baseline tps/se% | patched tps/se% | SPEEDUP | p95 ms b/p | RESULT
>   -----------------------------------------------------------------------
>   8    |   151897/ 0.76% |   152428/ 0.54% |  1.003x | 0.07 0.08 | noise
>   16   |   294014/ 0.59% |   296699/ 0.28% |  1.009x | 0.07 0.07 | noise
>   32   |   386817/ 2.18% |   377835/ 0.31% |  0.977x | 0.09 0.09 | noise
>   64   |   560950/16.97% |   481494/ 5.68% |  0.858x | 0.19 0.23 | noise
>   128  |   752079/ 4.92% |   729685/ 3.89% |  0.970x | 0.36 0.38 | noise
>   256  |   772771/ 0.62% |   771630/ 0.21% |  0.999x | 0.79 0.78 | noise
> 
>   schbench
>   =========================================
>   T   WRK  METRIC   | baseline/se%   | patched/se%    | SPEEDUP | RESULT
>   -----------------------------------------------------------------------
>   2   8    rps      |  1683.8/ 0.04% |  1681.3/ 0.10% |  0.999x | noise
>   2   8    wake_p99 |    10.2/ 1.96% |     9.8/ 3.82% |  1.041x | noise
>   2   8    req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
>   4   16   rps      |  3369.0/ 0.03% |  3353.9/ 0.44% |  0.996x | noise
>   4   16   wake_p99 |    10.0/ 0.00% |    10.0/ 0.00% |  1.000x | noise
>   4   16   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
>   8   32   rps      |  6724.6/ 0.04% |  6722.0/ 0.16% |  1.000x | noise
>   8   32   wake_p99 |     9.8/ 2.04% |    10.0/ 0.00% |  0.980x | noise
>   8   32   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
>   16  64   rps      | 10933.0/ 4.10% | 11179.8/ 1.80% |  1.023x | noise
>   16  64   wake_p99 |    12.0/ 0.00% |    12.0/ 0.00% |  1.000x | noise
>   16  64   req_p99  | 10051.2/ 0.13% | 10051.2/ 0.08% |  1.000x | noise
>   24  96   rps      | 12970.1/ 0.22% | 12971.0/ 0.48% |  1.000x | noise
>   24  96   wake_p99 |    13.4/ 3.81% |    12.4/ 1.98% |  1.081x | noise
>   24  96   req_p99  | 10179.2/ 0.21% | 10185.6/ 0.21% |  0.999x | noise
>   32  128  rps      | 12613.1/ 0.09% | 12667.2/ 0.11% |  1.004x | IMPROVED
>   32  128  wake_p99 |    37.2/ 3.55% |    34.2/ 1.43% |  1.088x | IMPROVED
>   32  128  req_p99  | 10467.2/ 0.59% | 10358.4/ 0.06% |  1.011x | noise
> 
> Link: https://lore.kernel.org/all/20261113153157.2495664-1-usama.arif@linux.dev/ #1
> 
> Fixes: 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")
> Reported-by: James Buck <jbuck2005.linux@outlook.com>
> Closes: https://lore.kernel.org/lkml/CY5P221MB09262B7D6A68954CC1B3199FBD442@CY5P221MB0926.NAMP221.PROD.OUTLOOK.COM/
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> Tested-by: James Buck <jbuck2005.linux@outlook.com>
> Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
> Tested-by: Christian Loehle <christian.loehle@arm.com>
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> Reviewed-by: Christian Loehle <christian.loehle@arm.com>

Looks good to me. I also tested it on NVIDIA Vera, no regressions (as
expected).

Tested-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>

Thanks,
-Andrea

> ---
>  kernel/sched/fair.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index da0d9e19c457..15ddfce49cb7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12936,9 +12936,16 @@ static void update_idle_cpu_scan(struct lb_env *env,
>  	tmp = min_t(long, tmp, SCHED_CAPACITY_SCALE);
>  	y = SCHED_CAPACITY_SCALE - tmp;
>  
> -	/* equation [2] */
> -	y *= llc_weight;
> +	/*
> +	 * equation [2]
> +	 * Scanning a small LLC is cheap, work conservation is
> +	 * preferred over limiting the scan depth. Treat a small
> +	 * LLC as if it had 32 CPUs, then the number of CPUs suggested
> +	 * by SIS_UTIL is scaled up for small LLCs.
> +	 */
> +	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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
  2026-11-30  8:16 [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system Chen Yu
  2026-11-30  9:20 ` Andrea Righi
@ 2026-11-30 10:28 ` K Prateek Nayak
  2026-12-01 13:28   ` Chen Yu
  2026-12-01  8:29 ` Li kunyu
  2 siblings, 1 reply; 7+ messages in thread
From: K Prateek Nayak @ 2026-11-30 10:28 UTC (permalink / raw)
  To: Chen Yu, Peter Zijlstra, Ingo Molnar
  Cc: Vincent Guittot, Andrea Righi, Christian Loehle, James Buck,
	Usama Arif, Tim Chen, linux-kernel

Hello Chenyu,

On 11/30/2026 1:46 PM, Chen Yu wrote:
> It was reported that scanning more CPUs on a system with a small LLC
> benefits the workload more than limiting the scan depth, because
> scanning more CPUs does not cost much and work conservation is
> preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
> to select_idle_capacity()"), James reported that one CPU-bound
> multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
> impacted a little bit.
> 
> Expand the scan depth so that systems with fewer than 32 CPUs per LLC
> behave like a 32-CPU system. This way, the scan number can be scaled up
> for such small systems.

Following are results from my 2x128C/256T Zen4c server.

tl;dr there are no surprises and a few winners. All data points that go
negative have run to run variation and the stable ones are neutral or
better. Feel free to include:

Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>

Full results:

  ==================================================================
  Test          : hackbench
  Units         : Normalized time in seconds
  Interpretation: Lower is better
  Statistic     : AMean
  ==================================================================
  Case:           tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
   1-groups     1.00 [ -0.00](11.96)     1.01 [ -0.53](10.38)
   2-groups     1.00 [ -0.00]( 9.23)     1.05 [ -5.11]( 3.15)
   4-groups     1.00 [ -0.00]( 2.59)     1.01 [ -1.28]( 2.08)
   8-groups     1.00 [ -0.00]( 2.72)     0.98 [  2.15]( 1.98)
  16-groups     1.00 [ -0.00]( 1.66)     0.98 [  1.91]( 1.18)


  ==================================================================
  Test          : tbench
  Units         : Normalized throughput
  Interpretation: Higher is better
  Statistic     : AMean
  ==================================================================
  Clients:    tip[pct imp](CV)       SIS_UTIL[pct imp](CV)
      1     1.00 [  0.00]( 0.60)     0.99 [ -1.21]( 0.11)
      2     1.00 [  0.00]( 1.34)     0.99 [ -0.52]( 0.11)
      4     1.00 [  0.00]( 0.25)     0.99 [ -0.75]( 0.10)
      8     1.00 [  0.00]( 0.05)     0.99 [ -1.24]( 0.47)
     16     1.00 [  0.00]( 0.17)     0.99 [ -1.12]( 0.28)
     32     1.00 [  0.00]( 0.09)     0.99 [ -0.77]( 0.03)
     64     1.00 [  0.00]( 0.23)     0.99 [ -1.11]( 0.18)
    128     1.00 [  0.00]( 0.39)     0.99 [ -1.26]( 0.09)
    256     1.00 [  0.00]( 0.16)     0.99 [ -0.90]( 0.33)
    512     1.00 [  0.00]( 0.91)     1.00 [ -0.17]( 1.00)
   1024     1.00 [  0.00]( 0.07)     0.99 [ -1.33]( 0.30)
   2048     1.00 [  0.00]( 0.11)     1.00 [  0.09]( 0.44)


  ==================================================================
  Test          : stream-10
  Units         : Normalized Bandwidth, MB/s
  Interpretation: Higher is better
  Statistic     : HMean
  ==================================================================
  Test:       tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
   Copy     1.00 [  0.00]( 0.56)     0.98 [ -1.55]( 5.30)
  Scale     1.00 [  0.00]( 0.61)     0.97 [ -2.73]( 8.24)
    Add     1.00 [  0.00]( 0.45)     0.96 [ -3.62]( 9.34)
  Triad     1.00 [  0.00]( 0.44)     0.96 [ -3.73]( 9.41)


  ==================================================================
  Test          : stream-100
  Units         : Normalized Bandwidth, MB/s
  Interpretation: Higher is better
  Statistic     : HMean
  ==================================================================
  Test:       tip[pct imp](CV)       SIS_UTIL[pct imp](CV)
   Copy     1.00 [  0.00]( 0.30)     1.00 [  0.46]( 0.26)
  Scale     1.00 [  0.00]( 0.70)     1.01 [  1.33]( 0.25)
    Add     1.00 [  0.00]( 0.48)     1.01 [  1.49]( 0.25)
  Triad     1.00 [  0.00]( 0.45)     1.02 [  1.60]( 0.30)


  ==================================================================
  Test          : netperf
  Units         : Normalized Througput
  Interpretation: Higher is better
  Statistic     : AMean
  ==================================================================
  Clients:           tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
     1-clients     1.00 [  0.00]( 0.10)     0.99 [ -1.40]( 0.30)
     2-clients     1.00 [  0.00]( 0.25)     0.99 [ -1.14]( 0.27)
     4-clients     1.00 [  0.00]( 0.27)     0.99 [ -1.05]( 0.23)
     8-clients     1.00 [  0.00]( 0.28)     0.99 [ -0.88]( 0.23)
    16-clients     1.00 [  0.00]( 0.20)     0.99 [ -0.99]( 0.26)
    32-clients     1.00 [  0.00]( 0.51)     0.99 [ -1.19]( 0.55)
    64-clients     1.00 [  0.00]( 0.80)     0.99 [ -0.90]( 0.69)
   128-clients     1.00 [  0.00]( 1.20)     0.99 [ -0.89]( 1.07)
   256-clients     1.00 [  0.00]( 1.08)     0.99 [ -0.69]( 1.17)
   512-clients     1.00 [  0.00]( 1.98)     1.00 [ -0.38]( 1.83)
   768-clients     1.00 [  0.00](27.74)     0.99 [ -0.61](28.47)
  1024-clients     1.00 [  0.00](17.72)     0.99 [ -0.59](17.95)


  ==================================================================
  Test          : schbench
  Units         : Normalized 99th percentile latency in us
  Interpretation: Lower is better
  Statistic     : Median
  ==================================================================
  #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
     1     1.00 [ -0.00]( 6.54)     1.00 [ -0.00]( 5.88)
     2     1.00 [ -0.00](19.21)     0.92 [  7.69](35.25)
     4     1.00 [ -0.00](18.56)     1.30 [-29.63]( 2.86)
     8     1.00 [ -0.00]( 8.25)     0.89 [ 11.36]( 3.88)
    16     1.00 [ -0.00]( 0.97)     0.98 [  1.69]( 1.97)
    32     1.00 [ -0.00]( 1.31)     0.98 [  2.25]( 0.66)
    64     1.00 [ -0.00]( 2.64)     0.94 [  5.84]( 0.69)
   128     1.00 [ -0.00]( 0.97)     0.96 [  3.66]( 1.53)
   256     1.00 [ -0.00]( 2.17)     0.95 [  5.39]( 0.22)
   512     1.00 [ -0.00]( 0.51)     0.96 [  3.98]( 5.43)
   768     1.00 [ -0.00]( 0.49)     1.01 [ -1.43]( 0.70)
  1024     1.00 [ -0.00](11.28)     0.92 [  7.57](10.34)


  ==================================================================
  Test          : new-schbench-requests-per-second
  Units         : Normalized Requests per second
  Interpretation: Higher is better
  Statistic     : Median
  ==================================================================
  #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
     1     1.00 [  0.00]( 0.15)     1.00 [  0.00]( 0.15)
     2     1.00 [  0.00]( 0.15)     1.00 [  0.29]( 0.15)
     4     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
     8     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
    16     1.00 [  0.00]( 0.00)     1.00 [  0.29]( 0.15)
    32     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
    64     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
   128     1.00 [  0.00]( 0.15)     0.72 [-27.71](18.44)
   256     1.00 [  0.00]( 0.44)     0.99 [ -0.57]( 0.44)
   512     1.00 [  0.00]( 0.18)     1.00 [  0.20]( 1.35)
   768     1.00 [  0.00]( 0.91)     0.99 [ -1.26]( 0.00)
  1024     1.00 [  0.00]( 0.60)     1.00 [  0.32]( 0.44)


  ==================================================================
  Test          : new-schbench-wakeup-latency
  Units         : Normalized 99th percentile latency in us
  Interpretation: Lower is better
  Statistic     : Median
  ==================================================================
  #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
     1     1.00 [ -0.00](30.82)     0.68 [ 32.00](27.25)
     2     1.00 [ -0.00](18.14)     0.33 [ 66.67]( 0.00)
     4     1.00 [ -0.00](16.75)     1.00 [ -0.00]( 4.84)
     8     1.00 [ -0.00]( 4.08)     0.92 [  7.69]( 0.00)
    16     1.00 [ -0.00]( 4.43)     0.92 [  8.33]( 4.56)
    32     1.00 [ -0.00]( 8.13)     0.91 [  9.09]( 5.00)
    64     1.00 [ -0.00]( 8.13)     1.00 [ -0.00]( 8.13)
   128     1.00 [ -0.00]( 0.00)     1.00 [ -0.00]( 9.01)
   256     1.00 [ -0.00]( 8.63)     0.95 [  5.45]( 2.02)
   512     1.00 [ -0.00]( 0.00)     1.00 [ -0.00](34.62)
   768     1.00 [ -0.00]( 0.15)     1.00 [ -0.00]( 0.00)
  1024     1.00 [ -0.00]( 0.56)     1.00 [  0.41]( 0.59)


  ==================================================================
  Test          : new-schbench-request-latency
  Units         : Normalized 99th percentile latency in us
  Interpretation: Lower is better
  Statistic     : Median
  ==================================================================
  #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
     1     1.00 [ -0.00]( 0.14)     1.00 [ -0.27]( 0.14)
     2     1.00 [ -0.00]( 0.27)     1.01 [ -0.53]( 0.24)
     4     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
     8     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
    16     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
    32     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
    64     1.00 [ -0.00]( 0.27)     1.01 [ -0.80]( 0.00)
   128     1.00 [ -0.00](24.01)     1.10 [-10.35](29.02)
   256     1.00 [ -0.00]( 0.23)     1.00 [ -0.00]( 0.26)
   512     1.00 [ -0.00]( 4.83)     1.08 [ -7.58](28.30)
   768     1.00 [ -0.00](11.38)     0.82 [ 18.47]( 0.75)
  1024     1.00 [ -0.00]( 2.33)     1.00 [ -0.34]( 1.75)

-- 
Thanks and Regards,
Prateek


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
  2026-11-30  8:16 [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system Chen Yu
  2026-11-30  9:20 ` Andrea Righi
  2026-11-30 10:28 ` K Prateek Nayak
@ 2026-12-01  8:29 ` Li kunyu
  2026-12-01 13:50   ` Chen Yu
  2 siblings, 1 reply; 7+ messages in thread
From: Li kunyu @ 2026-12-01  8:29 UTC (permalink / raw)
  To: Chen Yu, Peter Zijlstra, Ingo Molnar
  Cc: K Prateek Nayak, Vincent Guittot, Andrea Righi, Christian Loehle,
	James Buck, Usama Arif, Tim Chen, linux-kernel

Hi Chen Yu,

On 2026/11/30 16:16, Chen Yu wrote:
> It was reported that scanning more CPUs on a system with a small LLC
> benefits the workload more than limiting the scan depth, because
> scanning more CPUs does not cost much and work conservation is
> preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
> to select_idle_capacity()"), James reported that one CPU-bound
> multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
> impacted a little bit.
> 
> Expand the scan depth so that systems with fewer than 32 CPUs per LLC
> behave like a 32-CPU system. This way, the scan number can be scaled up
> for such small systems.
> 
> The effect is as below:
> nr_idle_scan before -> after the patch
> (LLC = 8, 12 and 16 CPUs for example)
> Cell format: util_sum : nr_scan before -> after
> Util% = util_sum / (llc_weight * 1024)
> 
>   Util% | LLC=8            | LLC=12           | LLC=16
>   ------+------------------+------------------+------------------
>    10%  |   819 :  7 ->  8 |  1228 : 11 -> 12 |  1638 : 15 -> 16
>    20%  |  1638 :  7 ->  8 |  2457 : 11 -> 12 |  3276 : 15 -> 16
>    30%  |  2457 :  7 ->  8 |  3686 : 10 -> 12 |  4915 : 14 -> 16
>    40%  |  3276 :  6 ->  8 |  4915 :  9 -> 12 |  6553 : 12 -> 16
>    50%  |  4096 :  5 ->  8 |  6144 :  7 -> 12 |  8192 : 10 -> 16
>    55%  |  4505 :  4 ->  8 |  6758 :  7 -> 12 |  9011 :  9 -> 16
>    60%  |  4915 :  4 ->  8 |  7372 :  6 -> 12 |  9830 :  8 -> 16
>    65%  |  5324 :  3 ->  8 |  7987 :  5 -> 12 | 10649 :  6 -> 13
>    70%  |  5734 :  2 ->  8 |  8601 :  3 -> 10 | 11468 :  5 -> 10
>    75%  |  6144 :  1 ->  7 |  9216 :  2 ->  7 | 12288 :  3 ->  7
>    80%  |  6553 :  1 ->  4 |  9830 :  1 ->  4 | 13107 :  2 ->  4
>    82%  |  6717 :  0 ->  2 | 10076 :  0 ->  2 | 13434 :  1 ->  2
>    84%  |  6881 :  0 ->  1 | 10321 :  0 ->  1 | 13762 :  0 ->  1
>    85%  |  6963 :  0 ->  0 | 10444 :  0 ->  0 | 13926 :  0 ->  0
>    86%  |  7045 :  0 ->  0 | 10567 :  0 ->  0 | 14090 :  0 ->  0
> 
> With this change, the regression was gone on Orange Pi 6 and Radxa O6.
> However, this change can not deal with the performance regression on
> Usama's 72-CPU NVIDIA Grace arm64 server. More investigation needs to
> be carried out for the large asymmetric CPU system [1], considering the
> number of idle CPUs besides the utilization in SIS_UTIL, e.g.
> 
> Since Intel servers usually have >= 32 CPUs per LLC, this change does
> not impact Intel servers much. AMD servers have 16 CPUs per CCX, testing
> on AMD Milan showed no significant difference on redis/mysql, and a slight
> improvement on hackbench/schbench:
> 
>   =========================================
>   hackbench threads+pipe
>     num_runs:      5
>     host:          AMD-Milan
>     kernel:        7.4.0-rc4-sis-patched+
>   =========================================
>   G   FD  | baseline s/se% | patched s/se%  | SPEEDUP | RESULT
>   ------------------------------------------------------------------
>   1   1   |   6.352/ 7.57% |   5.680/ 5.74% |   1.12x | noise
>   1   2   |   6.225/ 8.75% |   5.624/ 7.27% |   1.11x | noise
>   1   4   |   8.834/10.23% |   8.799/10.24% |   1.00x | noise
>   1   8   |   4.833/ 1.70% |   5.060/ 1.72% |   0.96x | noise
>   1   16  |   5.471/ 1.61% |   5.551/ 0.60% |   0.99x | noise
>   1   20  |   5.220/ 1.17% |   5.298/ 0.82% |   0.99x | noise
>   2   1   |   5.558/ 6.23% |   6.114/ 8.63% |   0.91x | noise
>   2   2   |   8.056/10.44% |   8.029/12.53% |   1.00x | noise
>   2   4   |   5.292/ 1.26% |   5.152/ 1.89% |   1.03x | noise
>   2   8   |   5.493/ 2.15% |   5.403/ 3.38% |   1.02x | noise
>   2   16  |   5.557/ 1.68% |   5.407/ 0.88% |   1.03x | noise
>   2   20  |   5.224/ 0.68% |   5.341/ 1.19% |   0.98x | noise
>   4   1   |   6.047/ 2.89% |   5.797/ 4.41% |   1.04x | noise
>   4   2   |   5.597/ 2.19% |   5.791/ 1.77% |   0.97x | noise
>   4   4   |   5.397/ 1.62% |   5.501/ 1.18% |   0.98x | noise
>   4   8   |   5.468/ 2.67% |   5.155/ 0.95% |   1.06x | IMPROVED
>   4   16  |   5.989/ 3.31% |   5.507/ 1.36% |   1.09x | IMPROVED
>   4   20  |   5.267/ 0.79% |   5.101/ 0.60% |   1.03x | IMPROVED
>   8   1   |   5.322/ 3.12% |   5.273/ 1.96% |   1.01x | noise
>   8   2   |   5.531/ 2.38% |   5.367/ 1.64% |   1.03x | noise
>   8   4   |   5.672/ 0.70% |   5.814/ 2.60% |   0.98x | noise
>   8   8   |   5.037/ 0.93% |   5.100/ 0.97% |   0.99x | noise
>   8   16  |   5.455/ 0.45% |   5.290/ 0.39% |   1.03x | IMPROVED
>   8   20  |   5.388/ 0.36% |   5.285/ 0.18% |   1.02x | IMPROVED
>   16  1   |   5.519/ 2.49% |   5.296/ 2.10% |   1.04x | noise
>   16  2   |   5.398/ 0.77% |   5.503/ 3.05% |   0.98x | noise
>   16  4   |   5.274/ 1.72% |   5.363/ 1.72% |   0.98x | noise
>   16  8   |   5.416/ 0.37% |   5.185/ 0.20% |   1.04x | IMPROVED
>   16  16  |   5.596/ 0.41% |   5.337/ 0.24% |   1.05x | IMPROVED
>   16  20  |   5.292/ 0.88% |   5.076/ 0.55% |   1.04x | IMPROVED
> 
>   redis (redis-benchmark -t set)
>   =========================================
>   THR | baseline rps/se% | patched rps/se% | SPEEDUP | p99 ms b/p  | RESULT
>   -----------------------------------------------------------------------
>   4   |  1492165/ 0.76% |  1480823/ 0.00% |  0.992x | 0.541 0.546 | noise
>   8   |  1665556/ 0.01% |  1665501/ 0.00% |  1.000x | 0.490 0.489 | noise
>   16  |   984279/ 0.60% |   974545/ 0.00% |  0.990x | 1.124 1.109 | noise
>   32  |   887091/ 0.01% |   883212/ 0.44% |  0.996x | 1.713 1.721 | noise
> 
>   mysql
>   =========================================
>   THR  | baseline tps/se% | patched tps/se% | SPEEDUP | p95 ms b/p | RESULT
>   -----------------------------------------------------------------------
>   8    |   151897/ 0.76% |   152428/ 0.54% |  1.003x | 0.07 0.08 | noise
>   16   |   294014/ 0.59% |   296699/ 0.28% |  1.009x | 0.07 0.07 | noise
>   32   |   386817/ 2.18% |   377835/ 0.31% |  0.977x | 0.09 0.09 | noise
>   64   |   560950/16.97% |   481494/ 5.68% |  0.858x | 0.19 0.23 | noise
>   128  |   752079/ 4.92% |   729685/ 3.89% |  0.970x | 0.36 0.38 | noise
>   256  |   772771/ 0.62% |   771630/ 0.21% |  0.999x | 0.79 0.78 | noise
> 
>   schbench
>   =========================================
>   T   WRK  METRIC   | baseline/se%   | patched/se%    | SPEEDUP | RESULT
>   -----------------------------------------------------------------------
>   2   8    rps      |  1683.8/ 0.04% |  1681.3/ 0.10% |  0.999x | noise
>   2   8    wake_p99 |    10.2/ 1.96% |     9.8/ 3.82% |  1.041x | noise
>   2   8    req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
>   4   16   rps      |  3369.0/ 0.03% |  3353.9/ 0.44% |  0.996x | noise
>   4   16   wake_p99 |    10.0/ 0.00% |    10.0/ 0.00% |  1.000x | noise
>   4   16   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
>   8   32   rps      |  6724.6/ 0.04% |  6722.0/ 0.16% |  1.000x | noise
>   8   32   wake_p99 |     9.8/ 2.04% |    10.0/ 0.00% |  0.980x | noise
>   8   32   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
>   16  64   rps      | 10933.0/ 4.10% | 11179.8/ 1.80% |  1.023x | noise
>   16  64   wake_p99 |    12.0/ 0.00% |    12.0/ 0.00% |  1.000x | noise
>   16  64   req_p99  | 10051.2/ 0.13% | 10051.2/ 0.08% |  1.000x | noise
>   24  96   rps      | 12970.1/ 0.22% | 12971.0/ 0.48% |  1.000x | noise
>   24  96   wake_p99 |    13.4/ 3.81% |    12.4/ 1.98% |  1.081x | noise
>   24  96   req_p99  | 10179.2/ 0.21% | 10185.6/ 0.21% |  0.999x | noise
>   32  128  rps      | 12613.1/ 0.09% | 12667.2/ 0.11% |  1.004x | IMPROVED
>   32  128  wake_p99 |    37.2/ 3.55% |    34.2/ 1.43% |  1.088x | IMPROVED
>   32  128  req_p99  | 10467.2/ 0.59% | 10358.4/ 0.06% |  1.011x | noise
> 
> Link: https://lore.kernel.org/all/20261113153157.2495664-1-usama.arif@linux.dev/ #1
> 
> Fixes: 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")
> Reported-by: James Buck <jbuck2005.linux@outlook.com>
> Closes: https://lore.kernel.org/lkml/CY5P221MB09262B7D6A68954CC1B3199FBD442@CY5P221MB0926.NAMP221.PROD.OUTLOOK.COM/
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> Tested-by: James Buck <jbuck2005.linux@outlook.com>
> Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
> Tested-by: Christian Loehle <christian.loehle@arm.com>
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> Reviewed-by: Christian Loehle <christian.loehle@arm.com>
> ---
>  kernel/sched/fair.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index da0d9e19c457..15ddfce49cb7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12936,9 +12936,16 @@ static void update_idle_cpu_scan(struct lb_env *env,
>  	tmp = min_t(long, tmp, SCHED_CAPACITY_SCALE);
>  	y = SCHED_CAPACITY_SCALE - tmp;
>  
> -	/* equation [2] */
> -	y *= llc_weight;
> +	/*
> +	 * equation [2]
> +	 * Scanning a small LLC is cheap, work conservation is
> +	 * preferred over limiting the scan depth. Treat a small
> +	 * LLC as if it had 32 CPUs, then the number of CPUs suggested
> +	 * by SIS_UTIL is scaled up for small LLCs.
> +	 */
> +	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);
>  }
> 

I conducted a comparative evaluation of this patch on a server equipped with a
Hygon 7447v CPU (Model 7, 384 logical cores). Apart from a significant
regression in hackbench, performance in the other benchmarks was quite good.

Tested-by: Li kunyu <likunyu@open-hieco.net>

The test data is provided below:

hackbench
=========================================
G	baseline s/se%	patched s/se%	SPEEDUP	pct	RESULT
1	0.1824 / 6.76%	0.1966 / 11.27%	0.93x	+7.79%	noise
2	0.2688 / 5.00%	0.3172 / 5.08%	0.85x	+18.01%	DEGRADED
4	0.3562 / 6.04%	0.3952 / 4.39%	0.90x	+10.95%	DEGRADED
8	0.5348 / 5.42%	0.5964 / 3.94%	0.90x	+11.52%	DEGRADED
16	0.8840 / 3.21%	0.8822 / 1.35%	1.00x	-0.20%	noise
32	1.3798 / 2.09%	1.4794 / 1.80%	0.93x	+7.22%	DEGRADED
64	2.4938 / 0.40%	2.4184 / 0.90%	1.03x	-3.02%	IMPROVED
128	4.4218 / 3.06%	4.3896 / 2.38%	1.01x	-0.73%	noise


schbench (99th)
=========================================
t	baseline/se%	patched/se%	SPEEDUP	 pct    RESULT
1	14.2 / 1.41%	11.0 / 13.79%	1.29x	-22.54%	IMPROVED
2	16.0 / 3.95%	16.8 / 3.47%	0.95x	+5.00%	noise
4	21.0 / 3.69%	19.0 / 9.70%	1.11x	-9.52%	noise
8	34.8 / 1.08%	33.4 / 1.53%	1.04x	-4.02%	noise
16	53.2 / 1.25%	52.2 / 2.74%	1.02x	-1.88%	noise
32	93.2 / 1.81%	81.0 / 2.17%	1.15x	-13.09%	IMPROVED
64	207.4 / 2.44%	214.2 / 1.92%	0.97x	+3.28%	noise
128	4497.6 / 1.48%	4007.2 / 2.19%	1.12x	-10.90%	IMPROVED
256	7848.0 / 1.67%	7918.4 / 1.12%	0.99x	+0.90%	noise
512	11299.2 / 0.44%	11344.0 / 0.84%	1.00x	+0.40%	noise


stream-10
=========================================
Kernel	baseline MB/s / se%	patched MB/s / se%	SPEEDUP	pct	RESULT
Copy	133432.18 / 1.76%	137247.15 / 3.29%	1.03x	+2.86%	noise
Scale	131576.94 / 2.61%	125294.50 / 3.59%	0.95x	-4.77%	noise
Add	157540.70 / 5.08%	149773.15 / 4.37%	0.95x	-4.93%	noise
Triad	155698.92 / 4.72%	147405.78 / 8.53%	0.95x	-5.33%	noise


stream-100
=========================================
Kernel	baseline MB/s / se%	patched MB/s / se%	SPEEDUP	pct	RESULT
Copy	151162.38 / 12.03%	197024.76 / 7.21%	1.30x	+30.34%	IMPROVED
Scale	150290.76 / 8.18%	178628.56 / 4.43%	1.19x	+18.86%	IMPROVED
Add	162542.60 / 5.32%	163776.48 / 6.06%	1.01x	+0.76%	noise
Triad	166483.52 / 4.37%	162575.52 / 6.89%	0.98x	-2.35%	noise


unixbench
=========================================
cpu     base      patch         pct      RESULT
1	1780.2	  1807.2	+1.52%   noise
384	118601.8  116258.1	-1.98%   noise

-- 
thanks,
kunyu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
  2026-11-30  9:20 ` Andrea Righi
@ 2026-12-01 13:25   ` Chen Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chen Yu @ 2026-12-01 13:25 UTC (permalink / raw)
  To: Andrea Righi
  Cc: Peter Zijlstra, Ingo Molnar, K Prateek Nayak, Vincent Guittot,
	Christian Loehle, James Buck, Usama Arif, Tim Chen, linux-kernel

Hi Andrea,

On Mon, Nov 30, 2026 at 10:20:04AM +0100, Andrea Righi wrote:
> Hello,
> 
> On Mon, Nov 30, 2026 at 04:16:07PM +0800, Chen Yu wrote:
> > It was reported that scanning more CPUs on a system with a small LLC
> > benefits the workload more than limiting the scan depth, because
> > scanning more CPUs does not cost much and work conservation is
> > preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
> > to select_idle_capacity()"), James reported that one CPU-bound
> > multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
> > impacted a little bit.
> > 
> > Expand the scan depth so that systems with fewer than 32 CPUs per LLC
> > behave like a 32-CPU system. This way, the scan number can be scaled up
> > for such small systems.
> > 
> > The effect is as below:
> > nr_idle_scan before -> after the patch
> > (LLC = 8, 12 and 16 CPUs for example)
> > Cell format: util_sum : nr_scan before -> after
> > Util% = util_sum / (llc_weight * 1024)
> > 
> >   Util% | LLC=8            | LLC=12           | LLC=16
> >   ------+------------------+------------------+------------------
> >    10%  |   819 :  7 ->  8 |  1228 : 11 -> 12 |  1638 : 15 -> 16
> >    20%  |  1638 :  7 ->  8 |  2457 : 11 -> 12 |  3276 : 15 -> 16
> >    30%  |  2457 :  7 ->  8 |  3686 : 10 -> 12 |  4915 : 14 -> 16
> >    40%  |  3276 :  6 ->  8 |  4915 :  9 -> 12 |  6553 : 12 -> 16
> >    50%  |  4096 :  5 ->  8 |  6144 :  7 -> 12 |  8192 : 10 -> 16
> >    55%  |  4505 :  4 ->  8 |  6758 :  7 -> 12 |  9011 :  9 -> 16
> >    60%  |  4915 :  4 ->  8 |  7372 :  6 -> 12 |  9830 :  8 -> 16
> >    65%  |  5324 :  3 ->  8 |  7987 :  5 -> 12 | 10649 :  6 -> 13
> >    70%  |  5734 :  2 ->  8 |  8601 :  3 -> 10 | 11468 :  5 -> 10
> >    75%  |  6144 :  1 ->  7 |  9216 :  2 ->  7 | 12288 :  3 ->  7
> >    80%  |  6553 :  1 ->  4 |  9830 :  1 ->  4 | 13107 :  2 ->  4
> >    82%  |  6717 :  0 ->  2 | 10076 :  0 ->  2 | 13434 :  1 ->  2
> >    84%  |  6881 :  0 ->  1 | 10321 :  0 ->  1 | 13762 :  0 ->  1
> >    85%  |  6963 :  0 ->  0 | 10444 :  0 ->  0 | 13926 :  0 ->  0
> >    86%  |  7045 :  0 ->  0 | 10567 :  0 ->  0 | 14090 :  0 ->  0
> > 
> > With this change, the regression was gone on Orange Pi 6 and Radxa O6.
> > However, this change can not deal with the performance regression on
> > Usama's 72-CPU NVIDIA Grace arm64 server. More investigation needs to
> > be carried out for the large asymmetric CPU system [1], considering the
> > number of idle CPUs besides the utilization in SIS_UTIL, e.g.
> > 
> > Since Intel servers usually have >= 32 CPUs per LLC, this change does
> > not impact Intel servers much. AMD servers have 16 CPUs per CCX, testing
> > on AMD Milan showed no significant difference on redis/mysql, and a slight
> > improvement on hackbench/schbench:
> > 
> >   =========================================
> >   hackbench threads+pipe
> >     num_runs:      5
> >     host:          AMD-Milan
> >     kernel:        7.4.0-rc4-sis-patched+
> >   =========================================
> >   G   FD  | baseline s/se% | patched s/se%  | SPEEDUP | RESULT
> >   ------------------------------------------------------------------
> >   1   1   |   6.352/ 7.57% |   5.680/ 5.74% |   1.12x | noise
> >   1   2   |   6.225/ 8.75% |   5.624/ 7.27% |   1.11x | noise
> >   1   4   |   8.834/10.23% |   8.799/10.24% |   1.00x | noise
> >   1   8   |   4.833/ 1.70% |   5.060/ 1.72% |   0.96x | noise
> >   1   16  |   5.471/ 1.61% |   5.551/ 0.60% |   0.99x | noise
> >   1   20  |   5.220/ 1.17% |   5.298/ 0.82% |   0.99x | noise
> >   2   1   |   5.558/ 6.23% |   6.114/ 8.63% |   0.91x | noise
> >   2   2   |   8.056/10.44% |   8.029/12.53% |   1.00x | noise
> >   2   4   |   5.292/ 1.26% |   5.152/ 1.89% |   1.03x | noise
> >   2   8   |   5.493/ 2.15% |   5.403/ 3.38% |   1.02x | noise
> >   2   16  |   5.557/ 1.68% |   5.407/ 0.88% |   1.03x | noise
> >   2   20  |   5.224/ 0.68% |   5.341/ 1.19% |   0.98x | noise
> >   4   1   |   6.047/ 2.89% |   5.797/ 4.41% |   1.04x | noise
> >   4   2   |   5.597/ 2.19% |   5.791/ 1.77% |   0.97x | noise
> >   4   4   |   5.397/ 1.62% |   5.501/ 1.18% |   0.98x | noise
> >   4   8   |   5.468/ 2.67% |   5.155/ 0.95% |   1.06x | IMPROVED
> >   4   16  |   5.989/ 3.31% |   5.507/ 1.36% |   1.09x | IMPROVED
> >   4   20  |   5.267/ 0.79% |   5.101/ 0.60% |   1.03x | IMPROVED
> >   8   1   |   5.322/ 3.12% |   5.273/ 1.96% |   1.01x | noise
> >   8   2   |   5.531/ 2.38% |   5.367/ 1.64% |   1.03x | noise
> >   8   4   |   5.672/ 0.70% |   5.814/ 2.60% |   0.98x | noise
> >   8   8   |   5.037/ 0.93% |   5.100/ 0.97% |   0.99x | noise
> >   8   16  |   5.455/ 0.45% |   5.290/ 0.39% |   1.03x | IMPROVED
> >   8   20  |   5.388/ 0.36% |   5.285/ 0.18% |   1.02x | IMPROVED
> >   16  1   |   5.519/ 2.49% |   5.296/ 2.10% |   1.04x | noise
> >   16  2   |   5.398/ 0.77% |   5.503/ 3.05% |   0.98x | noise
> >   16  4   |   5.274/ 1.72% |   5.363/ 1.72% |   0.98x | noise
> >   16  8   |   5.416/ 0.37% |   5.185/ 0.20% |   1.04x | IMPROVED
> >   16  16  |   5.596/ 0.41% |   5.337/ 0.24% |   1.05x | IMPROVED
> >   16  20  |   5.292/ 0.88% |   5.076/ 0.55% |   1.04x | IMPROVED
> > 
> >   redis (redis-benchmark -t set)
> >   =========================================
> >   THR | baseline rps/se% | patched rps/se% | SPEEDUP | p99 ms b/p  | RESULT
> >   -----------------------------------------------------------------------
> >   4   |  1492165/ 0.76% |  1480823/ 0.00% |  0.992x | 0.541 0.546 | noise
> >   8   |  1665556/ 0.01% |  1665501/ 0.00% |  1.000x | 0.490 0.489 | noise
> >   16  |   984279/ 0.60% |   974545/ 0.00% |  0.990x | 1.124 1.109 | noise
> >   32  |   887091/ 0.01% |   883212/ 0.44% |  0.996x | 1.713 1.721 | noise
> > 
> >   mysql
> >   =========================================
> >   THR  | baseline tps/se% | patched tps/se% | SPEEDUP | p95 ms b/p | RESULT
> >   -----------------------------------------------------------------------
> >   8    |   151897/ 0.76% |   152428/ 0.54% |  1.003x | 0.07 0.08 | noise
> >   16   |   294014/ 0.59% |   296699/ 0.28% |  1.009x | 0.07 0.07 | noise
> >   32   |   386817/ 2.18% |   377835/ 0.31% |  0.977x | 0.09 0.09 | noise
> >   64   |   560950/16.97% |   481494/ 5.68% |  0.858x | 0.19 0.23 | noise
> >   128  |   752079/ 4.92% |   729685/ 3.89% |  0.970x | 0.36 0.38 | noise
> >   256  |   772771/ 0.62% |   771630/ 0.21% |  0.999x | 0.79 0.78 | noise
> > 
> >   schbench
> >   =========================================
> >   T   WRK  METRIC   | baseline/se%   | patched/se%    | SPEEDUP | RESULT
> >   -----------------------------------------------------------------------
> >   2   8    rps      |  1683.8/ 0.04% |  1681.3/ 0.10% |  0.999x | noise
> >   2   8    wake_p99 |    10.2/ 1.96% |     9.8/ 3.82% |  1.041x | noise
> >   2   8    req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
> >   4   16   rps      |  3369.0/ 0.03% |  3353.9/ 0.44% |  0.996x | noise
> >   4   16   wake_p99 |    10.0/ 0.00% |    10.0/ 0.00% |  1.000x | noise
> >   4   16   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
> >   8   32   rps      |  6724.6/ 0.04% |  6722.0/ 0.16% |  1.000x | noise
> >   8   32   wake_p99 |     9.8/ 2.04% |    10.0/ 0.00% |  0.980x | noise
> >   8   32   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
> >   16  64   rps      | 10933.0/ 4.10% | 11179.8/ 1.80% |  1.023x | noise
> >   16  64   wake_p99 |    12.0/ 0.00% |    12.0/ 0.00% |  1.000x | noise
> >   16  64   req_p99  | 10051.2/ 0.13% | 10051.2/ 0.08% |  1.000x | noise
> >   24  96   rps      | 12970.1/ 0.22% | 12971.0/ 0.48% |  1.000x | noise
> >   24  96   wake_p99 |    13.4/ 3.81% |    12.4/ 1.98% |  1.081x | noise
> >   24  96   req_p99  | 10179.2/ 0.21% | 10185.6/ 0.21% |  0.999x | noise
> >   32  128  rps      | 12613.1/ 0.09% | 12667.2/ 0.11% |  1.004x | IMPROVED
> >   32  128  wake_p99 |    37.2/ 3.55% |    34.2/ 1.43% |  1.088x | IMPROVED
> >   32  128  req_p99  | 10467.2/ 0.59% | 10358.4/ 0.06% |  1.011x | noise
> > 
> > Link: https://lore.kernel.org/all/20261113153157.2495664-1-usama.arif@linux.dev/ #1
> > 
> > Fixes: 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")
> > Reported-by: James Buck <jbuck2005.linux@outlook.com>
> > Closes: https://lore.kernel.org/lkml/CY5P221MB09262B7D6A68954CC1B3199FBD442@CY5P221MB0926.NAMP221.PROD.OUTLOOK.COM/
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > Tested-by: James Buck <jbuck2005.linux@outlook.com>
> > Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
> > Tested-by: Christian Loehle <christian.loehle@arm.com>
> > Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> > Reviewed-by: Christian Loehle <christian.loehle@arm.com>
> 
> Looks good to me. I also tested it on NVIDIA Vera, no regressions (as
> expected).
> 
> Tested-by: Andrea Righi <arighi@nvidia.com>
> Reviewed-by: Andrea Righi <arighi@nvidia.com>
>

Thanks for the test and review!

Chenyu 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
  2026-11-30 10:28 ` K Prateek Nayak
@ 2026-12-01 13:28   ` Chen Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chen Yu @ 2026-12-01 13:28 UTC (permalink / raw)
  To: K Prateek Nayak
  Cc: Peter Zijlstra, Ingo Molnar, Vincent Guittot, Andrea Righi,
	Christian Loehle, James Buck, Usama Arif, Tim Chen, linux-kernel

Hi Prateek,

On Mon, Nov 30, 2026 at 03:58:09PM +0530, K Prateek Nayak wrote:
> Hello Chenyu,
> 
> On 11/30/2026 1:46 PM, Chen Yu wrote:
> > It was reported that scanning more CPUs on a system with a small LLC
> > benefits the workload more than limiting the scan depth, because
> > scanning more CPUs does not cost much and work conservation is
> > preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
> > to select_idle_capacity()"), James reported that one CPU-bound
> > multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
> > impacted a little bit.
> > 
> > Expand the scan depth so that systems with fewer than 32 CPUs per LLC
> > behave like a 32-CPU system. This way, the scan number can be scaled up
> > for such small systems.
> 
> Following are results from my 2x128C/256T Zen4c server.
> 
> tl;dr there are no surprises and a few winners. All data points that go
> negative have run to run variation and the stable ones are neutral or
> better. Feel free to include:
> 
> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
>

Thanks a ton for testing!

Chenyu
 
> Full results:
> 
>   ==================================================================
>   Test          : hackbench
>   Units         : Normalized time in seconds
>   Interpretation: Lower is better
>   Statistic     : AMean
>   ==================================================================
>   Case:           tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>    1-groups     1.00 [ -0.00](11.96)     1.01 [ -0.53](10.38)
>    2-groups     1.00 [ -0.00]( 9.23)     1.05 [ -5.11]( 3.15)
>    4-groups     1.00 [ -0.00]( 2.59)     1.01 [ -1.28]( 2.08)
>    8-groups     1.00 [ -0.00]( 2.72)     0.98 [  2.15]( 1.98)
>   16-groups     1.00 [ -0.00]( 1.66)     0.98 [  1.91]( 1.18)
> 
> 
>   ==================================================================
>   Test          : tbench
>   Units         : Normalized throughput
>   Interpretation: Higher is better
>   Statistic     : AMean
>   ==================================================================
>   Clients:    tip[pct imp](CV)       SIS_UTIL[pct imp](CV)
>       1     1.00 [  0.00]( 0.60)     0.99 [ -1.21]( 0.11)
>       2     1.00 [  0.00]( 1.34)     0.99 [ -0.52]( 0.11)
>       4     1.00 [  0.00]( 0.25)     0.99 [ -0.75]( 0.10)
>       8     1.00 [  0.00]( 0.05)     0.99 [ -1.24]( 0.47)
>      16     1.00 [  0.00]( 0.17)     0.99 [ -1.12]( 0.28)
>      32     1.00 [  0.00]( 0.09)     0.99 [ -0.77]( 0.03)
>      64     1.00 [  0.00]( 0.23)     0.99 [ -1.11]( 0.18)
>     128     1.00 [  0.00]( 0.39)     0.99 [ -1.26]( 0.09)
>     256     1.00 [  0.00]( 0.16)     0.99 [ -0.90]( 0.33)
>     512     1.00 [  0.00]( 0.91)     1.00 [ -0.17]( 1.00)
>    1024     1.00 [  0.00]( 0.07)     0.99 [ -1.33]( 0.30)
>    2048     1.00 [  0.00]( 0.11)     1.00 [  0.09]( 0.44)
> 
> 
>   ==================================================================
>   Test          : stream-10
>   Units         : Normalized Bandwidth, MB/s
>   Interpretation: Higher is better
>   Statistic     : HMean
>   ==================================================================
>   Test:       tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>    Copy     1.00 [  0.00]( 0.56)     0.98 [ -1.55]( 5.30)
>   Scale     1.00 [  0.00]( 0.61)     0.97 [ -2.73]( 8.24)
>     Add     1.00 [  0.00]( 0.45)     0.96 [ -3.62]( 9.34)
>   Triad     1.00 [  0.00]( 0.44)     0.96 [ -3.73]( 9.41)
> 
> 
>   ==================================================================
>   Test          : stream-100
>   Units         : Normalized Bandwidth, MB/s
>   Interpretation: Higher is better
>   Statistic     : HMean
>   ==================================================================
>   Test:       tip[pct imp](CV)       SIS_UTIL[pct imp](CV)
>    Copy     1.00 [  0.00]( 0.30)     1.00 [  0.46]( 0.26)
>   Scale     1.00 [  0.00]( 0.70)     1.01 [  1.33]( 0.25)
>     Add     1.00 [  0.00]( 0.48)     1.01 [  1.49]( 0.25)
>   Triad     1.00 [  0.00]( 0.45)     1.02 [  1.60]( 0.30)
> 
> 
>   ==================================================================
>   Test          : netperf
>   Units         : Normalized Througput
>   Interpretation: Higher is better
>   Statistic     : AMean
>   ==================================================================
>   Clients:           tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>      1-clients     1.00 [  0.00]( 0.10)     0.99 [ -1.40]( 0.30)
>      2-clients     1.00 [  0.00]( 0.25)     0.99 [ -1.14]( 0.27)
>      4-clients     1.00 [  0.00]( 0.27)     0.99 [ -1.05]( 0.23)
>      8-clients     1.00 [  0.00]( 0.28)     0.99 [ -0.88]( 0.23)
>     16-clients     1.00 [  0.00]( 0.20)     0.99 [ -0.99]( 0.26)
>     32-clients     1.00 [  0.00]( 0.51)     0.99 [ -1.19]( 0.55)
>     64-clients     1.00 [  0.00]( 0.80)     0.99 [ -0.90]( 0.69)
>    128-clients     1.00 [  0.00]( 1.20)     0.99 [ -0.89]( 1.07)
>    256-clients     1.00 [  0.00]( 1.08)     0.99 [ -0.69]( 1.17)
>    512-clients     1.00 [  0.00]( 1.98)     1.00 [ -0.38]( 1.83)
>    768-clients     1.00 [  0.00](27.74)     0.99 [ -0.61](28.47)
>   1024-clients     1.00 [  0.00](17.72)     0.99 [ -0.59](17.95)
> 
> 
>   ==================================================================
>   Test          : schbench
>   Units         : Normalized 99th percentile latency in us
>   Interpretation: Lower is better
>   Statistic     : Median
>   ==================================================================
>   #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>      1     1.00 [ -0.00]( 6.54)     1.00 [ -0.00]( 5.88)
>      2     1.00 [ -0.00](19.21)     0.92 [  7.69](35.25)
>      4     1.00 [ -0.00](18.56)     1.30 [-29.63]( 2.86)
>      8     1.00 [ -0.00]( 8.25)     0.89 [ 11.36]( 3.88)
>     16     1.00 [ -0.00]( 0.97)     0.98 [  1.69]( 1.97)
>     32     1.00 [ -0.00]( 1.31)     0.98 [  2.25]( 0.66)
>     64     1.00 [ -0.00]( 2.64)     0.94 [  5.84]( 0.69)
>    128     1.00 [ -0.00]( 0.97)     0.96 [  3.66]( 1.53)
>    256     1.00 [ -0.00]( 2.17)     0.95 [  5.39]( 0.22)
>    512     1.00 [ -0.00]( 0.51)     0.96 [  3.98]( 5.43)
>    768     1.00 [ -0.00]( 0.49)     1.01 [ -1.43]( 0.70)
>   1024     1.00 [ -0.00](11.28)     0.92 [  7.57](10.34)
> 
> 
>   ==================================================================
>   Test          : new-schbench-requests-per-second
>   Units         : Normalized Requests per second
>   Interpretation: Higher is better
>   Statistic     : Median
>   ==================================================================
>   #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>      1     1.00 [  0.00]( 0.15)     1.00 [  0.00]( 0.15)
>      2     1.00 [  0.00]( 0.15)     1.00 [  0.29]( 0.15)
>      4     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
>      8     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
>     16     1.00 [  0.00]( 0.00)     1.00 [  0.29]( 0.15)
>     32     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
>     64     1.00 [  0.00]( 0.00)     1.00 [  0.00]( 0.00)
>    128     1.00 [  0.00]( 0.15)     0.72 [-27.71](18.44)
>    256     1.00 [  0.00]( 0.44)     0.99 [ -0.57]( 0.44)
>    512     1.00 [  0.00]( 0.18)     1.00 [  0.20]( 1.35)
>    768     1.00 [  0.00]( 0.91)     0.99 [ -1.26]( 0.00)
>   1024     1.00 [  0.00]( 0.60)     1.00 [  0.32]( 0.44)
> 
> 
>   ==================================================================
>   Test          : new-schbench-wakeup-latency
>   Units         : Normalized 99th percentile latency in us
>   Interpretation: Lower is better
>   Statistic     : Median
>   ==================================================================
>   #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>      1     1.00 [ -0.00](30.82)     0.68 [ 32.00](27.25)
>      2     1.00 [ -0.00](18.14)     0.33 [ 66.67]( 0.00)
>      4     1.00 [ -0.00](16.75)     1.00 [ -0.00]( 4.84)
>      8     1.00 [ -0.00]( 4.08)     0.92 [  7.69]( 0.00)
>     16     1.00 [ -0.00]( 4.43)     0.92 [  8.33]( 4.56)
>     32     1.00 [ -0.00]( 8.13)     0.91 [  9.09]( 5.00)
>     64     1.00 [ -0.00]( 8.13)     1.00 [ -0.00]( 8.13)
>    128     1.00 [ -0.00]( 0.00)     1.00 [ -0.00]( 9.01)
>    256     1.00 [ -0.00]( 8.63)     0.95 [  5.45]( 2.02)
>    512     1.00 [ -0.00]( 0.00)     1.00 [ -0.00](34.62)
>    768     1.00 [ -0.00]( 0.15)     1.00 [ -0.00]( 0.00)
>   1024     1.00 [ -0.00]( 0.56)     1.00 [  0.41]( 0.59)
> 
> 
>   ==================================================================
>   Test          : new-schbench-request-latency
>   Units         : Normalized 99th percentile latency in us
>   Interpretation: Lower is better
>   Statistic     : Median
>   ==================================================================
>   #workers:  tip[pct imp](CV)      SIS_UTIL[pct imp](CV)
>      1     1.00 [ -0.00]( 0.14)     1.00 [ -0.27]( 0.14)
>      2     1.00 [ -0.00]( 0.27)     1.01 [ -0.53]( 0.24)
>      4     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
>      8     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
>     16     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
>     32     1.00 [ -0.00]( 0.00)     1.01 [ -0.53]( 0.00)
>     64     1.00 [ -0.00]( 0.27)     1.01 [ -0.80]( 0.00)
>    128     1.00 [ -0.00](24.01)     1.10 [-10.35](29.02)
>    256     1.00 [ -0.00]( 0.23)     1.00 [ -0.00]( 0.26)
>    512     1.00 [ -0.00]( 4.83)     1.08 [ -7.58](28.30)
>    768     1.00 [ -0.00](11.38)     0.82 [ 18.47]( 0.75)
>   1024     1.00 [ -0.00]( 2.33)     1.00 [ -0.34]( 1.75)
> 
> -- 
> Thanks and Regards,
> Prateek
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system
  2026-12-01  8:29 ` Li kunyu
@ 2026-12-01 13:50   ` Chen Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chen Yu @ 2026-12-01 13:50 UTC (permalink / raw)
  To: Li kunyu
  Cc: Peter Zijlstra, Ingo Molnar, K Prateek Nayak, Vincent Guittot,
	Andrea Righi, Christian Loehle, James Buck, Usama Arif, Tim Chen,
	linux-kernel

On Tue, Dec 01, 2026 at 04:29:43PM +0800, Li kunyu wrote:
> Hi Chen Yu,
> 
> On 2026/11/30 16:16, Chen Yu wrote:
> > It was reported that scanning more CPUs on a system with a small LLC
> > benefits the workload more than limiting the scan depth, because
> > scanning more CPUs does not cost much and work conservation is
> > preferred. After commit 61ea17a63719 ("sched/fair: Add SIS_UTIL support
> > to select_idle_capacity()"), James reported that one CPU-bound
> > multi-threaded work on his big.LITTLE arm64 board Orange Pi 6 was
> > impacted a little bit.
> > 
> > Expand the scan depth so that systems with fewer than 32 CPUs per LLC
> > behave like a 32-CPU system. This way, the scan number can be scaled up
> > for such small systems.
> > 
> > The effect is as below:
> > nr_idle_scan before -> after the patch
> > (LLC = 8, 12 and 16 CPUs for example)
> > Cell format: util_sum : nr_scan before -> after
> > Util% = util_sum / (llc_weight * 1024)
> > 
> >   Util% | LLC=8            | LLC=12           | LLC=16
> >   ------+------------------+------------------+------------------
> >    10%  |   819 :  7 ->  8 |  1228 : 11 -> 12 |  1638 : 15 -> 16
> >    20%  |  1638 :  7 ->  8 |  2457 : 11 -> 12 |  3276 : 15 -> 16
> >    30%  |  2457 :  7 ->  8 |  3686 : 10 -> 12 |  4915 : 14 -> 16
> >    40%  |  3276 :  6 ->  8 |  4915 :  9 -> 12 |  6553 : 12 -> 16
> >    50%  |  4096 :  5 ->  8 |  6144 :  7 -> 12 |  8192 : 10 -> 16
> >    55%  |  4505 :  4 ->  8 |  6758 :  7 -> 12 |  9011 :  9 -> 16
> >    60%  |  4915 :  4 ->  8 |  7372 :  6 -> 12 |  9830 :  8 -> 16
> >    65%  |  5324 :  3 ->  8 |  7987 :  5 -> 12 | 10649 :  6 -> 13
> >    70%  |  5734 :  2 ->  8 |  8601 :  3 -> 10 | 11468 :  5 -> 10
> >    75%  |  6144 :  1 ->  7 |  9216 :  2 ->  7 | 12288 :  3 ->  7
> >    80%  |  6553 :  1 ->  4 |  9830 :  1 ->  4 | 13107 :  2 ->  4
> >    82%  |  6717 :  0 ->  2 | 10076 :  0 ->  2 | 13434 :  1 ->  2
> >    84%  |  6881 :  0 ->  1 | 10321 :  0 ->  1 | 13762 :  0 ->  1
> >    85%  |  6963 :  0 ->  0 | 10444 :  0 ->  0 | 13926 :  0 ->  0
> >    86%  |  7045 :  0 ->  0 | 10567 :  0 ->  0 | 14090 :  0 ->  0
> > 
> > With this change, the regression was gone on Orange Pi 6 and Radxa O6.
> > However, this change can not deal with the performance regression on
> > Usama's 72-CPU NVIDIA Grace arm64 server. More investigation needs to
> > be carried out for the large asymmetric CPU system [1], considering the
> > number of idle CPUs besides the utilization in SIS_UTIL, e.g.
> > 
> > Since Intel servers usually have >= 32 CPUs per LLC, this change does
> > not impact Intel servers much. AMD servers have 16 CPUs per CCX, testing
> > on AMD Milan showed no significant difference on redis/mysql, and a slight
> > improvement on hackbench/schbench:
> > 
> >   =========================================
> >   hackbench threads+pipe
> >     num_runs:      5
> >     host:          AMD-Milan
> >     kernel:        7.4.0-rc4-sis-patched+
> >   =========================================
> >   G   FD  | baseline s/se% | patched s/se%  | SPEEDUP | RESULT
> >   ------------------------------------------------------------------
> >   1   1   |   6.352/ 7.57% |   5.680/ 5.74% |   1.12x | noise
> >   1   2   |   6.225/ 8.75% |   5.624/ 7.27% |   1.11x | noise
> >   1   4   |   8.834/10.23% |   8.799/10.24% |   1.00x | noise
> >   1   8   |   4.833/ 1.70% |   5.060/ 1.72% |   0.96x | noise
> >   1   16  |   5.471/ 1.61% |   5.551/ 0.60% |   0.99x | noise
> >   1   20  |   5.220/ 1.17% |   5.298/ 0.82% |   0.99x | noise
> >   2   1   |   5.558/ 6.23% |   6.114/ 8.63% |   0.91x | noise
> >   2   2   |   8.056/10.44% |   8.029/12.53% |   1.00x | noise
> >   2   4   |   5.292/ 1.26% |   5.152/ 1.89% |   1.03x | noise
> >   2   8   |   5.493/ 2.15% |   5.403/ 3.38% |   1.02x | noise
> >   2   16  |   5.557/ 1.68% |   5.407/ 0.88% |   1.03x | noise
> >   2   20  |   5.224/ 0.68% |   5.341/ 1.19% |   0.98x | noise
> >   4   1   |   6.047/ 2.89% |   5.797/ 4.41% |   1.04x | noise
> >   4   2   |   5.597/ 2.19% |   5.791/ 1.77% |   0.97x | noise
> >   4   4   |   5.397/ 1.62% |   5.501/ 1.18% |   0.98x | noise
> >   4   8   |   5.468/ 2.67% |   5.155/ 0.95% |   1.06x | IMPROVED
> >   4   16  |   5.989/ 3.31% |   5.507/ 1.36% |   1.09x | IMPROVED
> >   4   20  |   5.267/ 0.79% |   5.101/ 0.60% |   1.03x | IMPROVED
> >   8   1   |   5.322/ 3.12% |   5.273/ 1.96% |   1.01x | noise
> >   8   2   |   5.531/ 2.38% |   5.367/ 1.64% |   1.03x | noise
> >   8   4   |   5.672/ 0.70% |   5.814/ 2.60% |   0.98x | noise
> >   8   8   |   5.037/ 0.93% |   5.100/ 0.97% |   0.99x | noise
> >   8   16  |   5.455/ 0.45% |   5.290/ 0.39% |   1.03x | IMPROVED
> >   8   20  |   5.388/ 0.36% |   5.285/ 0.18% |   1.02x | IMPROVED
> >   16  1   |   5.519/ 2.49% |   5.296/ 2.10% |   1.04x | noise
> >   16  2   |   5.398/ 0.77% |   5.503/ 3.05% |   0.98x | noise
> >   16  4   |   5.274/ 1.72% |   5.363/ 1.72% |   0.98x | noise
> >   16  8   |   5.416/ 0.37% |   5.185/ 0.20% |   1.04x | IMPROVED
> >   16  16  |   5.596/ 0.41% |   5.337/ 0.24% |   1.05x | IMPROVED
> >   16  20  |   5.292/ 0.88% |   5.076/ 0.55% |   1.04x | IMPROVED
> > 
> >   redis (redis-benchmark -t set)
> >   =========================================
> >   THR | baseline rps/se% | patched rps/se% | SPEEDUP | p99 ms b/p  | RESULT
> >   -----------------------------------------------------------------------
> >   4   |  1492165/ 0.76% |  1480823/ 0.00% |  0.992x | 0.541 0.546 | noise
> >   8   |  1665556/ 0.01% |  1665501/ 0.00% |  1.000x | 0.490 0.489 | noise
> >   16  |   984279/ 0.60% |   974545/ 0.00% |  0.990x | 1.124 1.109 | noise
> >   32  |   887091/ 0.01% |   883212/ 0.44% |  0.996x | 1.713 1.721 | noise
> > 
> >   mysql
> >   =========================================
> >   THR  | baseline tps/se% | patched tps/se% | SPEEDUP | p95 ms b/p | RESULT
> >   -----------------------------------------------------------------------
> >   8    |   151897/ 0.76% |   152428/ 0.54% |  1.003x | 0.07 0.08 | noise
> >   16   |   294014/ 0.59% |   296699/ 0.28% |  1.009x | 0.07 0.07 | noise
> >   32   |   386817/ 2.18% |   377835/ 0.31% |  0.977x | 0.09 0.09 | noise
> >   64   |   560950/16.97% |   481494/ 5.68% |  0.858x | 0.19 0.23 | noise
> >   128  |   752079/ 4.92% |   729685/ 3.89% |  0.970x | 0.36 0.38 | noise
> >   256  |   772771/ 0.62% |   771630/ 0.21% |  0.999x | 0.79 0.78 | noise
> > 
> >   schbench
> >   =========================================
> >   T   WRK  METRIC   | baseline/se%   | patched/se%    | SPEEDUP | RESULT
> >   -----------------------------------------------------------------------
> >   2   8    rps      |  1683.8/ 0.04% |  1681.3/ 0.10% |  0.999x | noise
> >   2   8    wake_p99 |    10.2/ 1.96% |     9.8/ 3.82% |  1.041x | noise
> >   2   8    req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
> >   4   16   rps      |  3369.0/ 0.03% |  3353.9/ 0.44% |  0.996x | noise
> >   4   16   wake_p99 |    10.0/ 0.00% |    10.0/ 0.00% |  1.000x | noise
> >   4   16   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
> >   8   32   rps      |  6724.6/ 0.04% |  6722.0/ 0.16% |  1.000x | noise
> >   8   32   wake_p99 |     9.8/ 2.04% |    10.0/ 0.00% |  0.980x | noise
> >   8   32   req_p99  |  4904.0/ 0.00% |  4904.0/ 0.00% |  1.000x | noise
> >   16  64   rps      | 10933.0/ 4.10% | 11179.8/ 1.80% |  1.023x | noise
> >   16  64   wake_p99 |    12.0/ 0.00% |    12.0/ 0.00% |  1.000x | noise
> >   16  64   req_p99  | 10051.2/ 0.13% | 10051.2/ 0.08% |  1.000x | noise
> >   24  96   rps      | 12970.1/ 0.22% | 12971.0/ 0.48% |  1.000x | noise
> >   24  96   wake_p99 |    13.4/ 3.81% |    12.4/ 1.98% |  1.081x | noise
> >   24  96   req_p99  | 10179.2/ 0.21% | 10185.6/ 0.21% |  0.999x | noise
> >   32  128  rps      | 12613.1/ 0.09% | 12667.2/ 0.11% |  1.004x | IMPROVED
> >   32  128  wake_p99 |    37.2/ 3.55% |    34.2/ 1.43% |  1.088x | IMPROVED
> >   32  128  req_p99  | 10467.2/ 0.59% | 10358.4/ 0.06% |  1.011x | noise
> > 
> > Link: https://lore.kernel.org/all/20261113153157.2495664-1-usama.arif@linux.dev/ #1
> > 
> > Fixes: 61ea17a63719 ("sched/fair: Add SIS_UTIL support to select_idle_capacity()")
> > Reported-by: James Buck <jbuck2005.linux@outlook.com>
> > Closes: https://lore.kernel.org/lkml/CY5P221MB09262B7D6A68954CC1B3199FBD442@CY5P221MB0926.NAMP221.PROD.OUTLOOK.COM/
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > Tested-by: James Buck <jbuck2005.linux@outlook.com>
> > Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
> > Tested-by: Christian Loehle <christian.loehle@arm.com>
> > Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> > Reviewed-by: Christian Loehle <christian.loehle@arm.com>
> > ---
> >  kernel/sched/fair.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index da0d9e19c457..15ddfce49cb7 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -12936,9 +12936,16 @@ static void update_idle_cpu_scan(struct lb_env *env,
> >  	tmp = min_t(long, tmp, SCHED_CAPACITY_SCALE);
> >  	y = SCHED_CAPACITY_SCALE - tmp;
> >  
> > -	/* equation [2] */
> > -	y *= llc_weight;
> > +	/*
> > +	 * equation [2]
> > +	 * Scanning a small LLC is cheap, work conservation is
> > +	 * preferred over limiting the scan depth. Treat a small
> > +	 * LLC as if it had 32 CPUs, then the number of CPUs suggested
> > +	 * by SIS_UTIL is scaled up for small LLCs.
> > +	 */
> > +	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);
> >  }
> > 
> 
> I conducted a comparative evaluation of this patch on a server equipped with a
> Hygon 7447v CPU (Model 7, 384 logical cores). Apart from a significant
> regression in hackbench, performance in the other benchmarks was quite good.
> 
> Tested-by: Li kunyu <likunyu@open-hieco.net>
>

Thanks very much for testing! Regarding the hackbench regression, may I
know how many CPUs there are in one LLC? This seems to be a trade-off,
considering that other benchmarks benefit from the work conservation
on your system.

thanks,
Chenyu
 
> The test data is provided below:
> 
> hackbench
> =========================================
> G	baseline s/se%	patched s/se%	SPEEDUP	pct	RESULT
> 1	0.1824 / 6.76%	0.1966 / 11.27%	0.93x	+7.79%	noise
> 2	0.2688 / 5.00%	0.3172 / 5.08%	0.85x	+18.01%	DEGRADED
> 4	0.3562 / 6.04%	0.3952 / 4.39%	0.90x	+10.95%	DEGRADED
> 8	0.5348 / 5.42%	0.5964 / 3.94%	0.90x	+11.52%	DEGRADED
> 16	0.8840 / 3.21%	0.8822 / 1.35%	1.00x	-0.20%	noise
> 32	1.3798 / 2.09%	1.4794 / 1.80%	0.93x	+7.22%	DEGRADED
> 64	2.4938 / 0.40%	2.4184 / 0.90%	1.03x	-3.02%	IMPROVED
> 128	4.4218 / 3.06%	4.3896 / 2.38%	1.01x	-0.73%	noise
> 
> 
> schbench (99th)
> =========================================
> t	baseline/se%	patched/se%	SPEEDUP	 pct    RESULT
> 1	14.2 / 1.41%	11.0 / 13.79%	1.29x	-22.54%	IMPROVED
> 2	16.0 / 3.95%	16.8 / 3.47%	0.95x	+5.00%	noise
> 4	21.0 / 3.69%	19.0 / 9.70%	1.11x	-9.52%	noise
> 8	34.8 / 1.08%	33.4 / 1.53%	1.04x	-4.02%	noise
> 16	53.2 / 1.25%	52.2 / 2.74%	1.02x	-1.88%	noise
> 32	93.2 / 1.81%	81.0 / 2.17%	1.15x	-13.09%	IMPROVED
> 64	207.4 / 2.44%	214.2 / 1.92%	0.97x	+3.28%	noise
> 128	4497.6 / 1.48%	4007.2 / 2.19%	1.12x	-10.90%	IMPROVED
> 256	7848.0 / 1.67%	7918.4 / 1.12%	0.99x	+0.90%	noise
> 512	11299.2 / 0.44%	11344.0 / 0.84%	1.00x	+0.40%	noise
> 
> 
> stream-10
> =========================================
> Kernel	baseline MB/s / se%	patched MB/s / se%	SPEEDUP	pct	RESULT
> Copy	133432.18 / 1.76%	137247.15 / 3.29%	1.03x	+2.86%	noise
> Scale	131576.94 / 2.61%	125294.50 / 3.59%	0.95x	-4.77%	noise
> Add	157540.70 / 5.08%	149773.15 / 4.37%	0.95x	-4.93%	noise
> Triad	155698.92 / 4.72%	147405.78 / 8.53%	0.95x	-5.33%	noise
> 
> 
> stream-100
> =========================================
> Kernel	baseline MB/s / se%	patched MB/s / se%	SPEEDUP	pct	RESULT
> Copy	151162.38 / 12.03%	197024.76 / 7.21%	1.30x	+30.34%	IMPROVED
> Scale	150290.76 / 8.18%	178628.56 / 4.43%	1.19x	+18.86%	IMPROVED
> Add	162542.60 / 5.32%	163776.48 / 6.06%	1.01x	+0.76%	noise
> Triad	166483.52 / 4.37%	162575.52 / 6.89%	0.98x	-2.35%	noise
> 
> 
> unixbench
> =========================================
> cpu     base      patch         pct      RESULT
> 1	1780.2	  1807.2	+1.52%   noise
> 384	118601.8  116258.1	-1.98%   noise
> 
> -- 
> thanks,
> kunyu

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-01 14:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  8:16 [PATCH] sched/fair: Expand SIS_UTIL scan depth for small LLC system Chen Yu
2026-11-30  9:20 ` Andrea Righi
2026-12-01 13:25   ` Chen Yu
2026-11-30 10:28 ` K Prateek Nayak
2026-12-01 13:28   ` Chen Yu
2026-12-01  8:29 ` Li kunyu
2026-12-01 13:50   ` Chen Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox