486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression
kernel test robot
build botHello,
kernel test robot noticed a 33.3% regression of stress-ng.switch.ops_per_sec on:
commit: 486c3d06b90240860e99686d29ed9f15637dc314 ("sched/fair: Avoid transient double accounting for delayed tasks") https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
testcase: stress-ng
config: x86_64-rhel-9.4
compiler: gcc-14
test machine: 224 threads 2 sockets Intel(R) Xeon(R) Platinum 8480CTDX (Sapphire Rapids) with 256G memory parameters:
nr_threads: 100%
testtime: 60s
test: switch
method: pipe
cpufreq_governor: performance
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]
Details are as below:
-------------------------------------------------------------------------------------------------->
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20261123/[email protected]
=========================================================================================
compiler/cpufreq_governor/kconfig/method/nr_threads/rootfs/tbox_group/test/testcase/testtime:
gcc-14/performance/x86_64-rhel-9.4/pipe/100%/debian-13-x86_64-20250902.cgz/lkp-spr-r02/switch/stress-ng/60s
commit:
75545668ae ("sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle") 486c3d06b9 ("sched/fair: Avoid transient double accounting for delayed tasks")
75545668ae0fd80c 486c3d06b90240860e99686d29e
---------------- ---------------------------
%stddev %change %stddev
\ | \
4113 +49.9% 6165 stress-ng.switch.nanosecs_per_context_switch_pipe_method
3.265e+09 -33.3% 2.178e+09 stress-ng.switch.ops
54451715 -33.3% 36327730 stress-ng.switch.ops_per_sec
77740057 ± 6% +63.2% 1.269e+08 ± 6% stress-ng.time.involuntary_context_switches
37428 -4.5% 35727 ± 2% stress-ng.time.minor_page_faults
21920 -16.1% 18382 stress-ng.time.percent_of_cpu_this_job_got
12118 -16.1% 10162 stress-ng.time.system_time
1052 -16.2% 881.56 stress-ng.time.user_time
6.431e+09 -40.8% 3.81e+09 stress-ng.time.voluntary_context_switchesDisclaimer:
Results have been estimated based on internal Intel analysis and are provided for informational purposes only. Any difference in system hardware or software design or configuration may affect actual performance.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 21 lines · kernel test robot
Hello,
kernel test robot noticed a 33.3% regression of stress-ng.switch.ops_per_sec on:
commit:
486c3d06b90240860e99686d29ed9f15637dc314("sched/fair: Avoid transient double accounting for delayed tasks") https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git mastertestcase: stress-ng
config: x86_64-rhel-9.4
compiler: gcc-14
test machine: 224 threads 2 sockets Intel(R) Xeon(R) Platinum 8480CTDX (Sapphire Rapids) with 256G memory parameters:
nr_threads: 100%
testtime: 60s
test: switch
method: pipe
cpufreq_governor: performance
Quoted 3 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]
I fed this to AI and asked it to reproduced it on a server, later AI told me:
- int h_nr_runnable = 0;
+ int h_nr_runnable = 1;
was missing in dequeue_hierarchy() from https://lore.kernel.org/all/[email protected]/
when merging into 486c3d06b902
From 850d8788c72d6ae459034b85584cd5ea01df920e Mon Sep 17 00:00:00 2001
From: Chen Yu <[email protected]>
Date: Mon, 23 Nov 2026 14:27:20 +0800
Subject: [PATCH] sched/fair: Fix h_nr_runnable leak in dequeue_hierarchy()
commit 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks") changed the default of h_nr_runnable in dequeue_hierarchy() from 0 to 1 and only cleared it for an already delayed entity:
int h_nr_runnable = 1; ... /* Already accounted via set_delayed(). */ if (se->sched_delayed) h_nr_runnable = 0;
The adjust of h_nr_runnable to 1 was lost when merging into vanilla, h_nr_runnable is now 0 for every dequeue, which breaks logic consuming h_nr_runnable.
Bring back the adjustment for h_nr_runnable.
[1] https://lore.kernel.org/all/[email protected]/
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -8242,7 +8242,7 @@ static void dequeue_hierarchy(struct task_struct *p, int flags) {struct sched_entity *se = &p->se;bool task_throttled = flags &DEQUEUE_THROTTLE ; -int h_nr_runnable =0 ; +int h_nr_runnable =1 ;int h_nr_idle =task_has_idle_policy (p);bool dequeue = true;
Signature · 1 line
2.25.1
Hello Chenyu,
Quoted 43 lines · Chen Yu
I fed this to AI and asked it to reproduced it on a server, later AI told me:
kernel/sched/fair.c +1
-1-int h_nr_runnable =0 ; +int h_nr_runnable =1 ;was missing in
dequeue_hierarchy()from https://lore.kernel.org/all/[email protected]/
when merging into486c3d06b902From
850d8788c72d6ae459034b85584cd5ea01df920eMon Sep 17 00:00:00 2001
From: Chen Yu <[email protected]>
Date: Mon, 23 Nov 2026 14:27:20 +0800
Subject: [PATCH] sched/fair: Fixh_nr_runnableleak indequeue_hierarchy()commit
486c3d06b902("sched/fair: Avoid transient double accounting for delayed tasks") changed the default ofh_nr_runnableindequeue_hierarchy()from 0 to 1 and only cleared it for an already delayed entity:int h_nr_runnable = 1; ... /* Already accounted via set_delayed(). */ if (se->sched_delayed) h_nr_runnable = 0;The adjust of
h_nr_runnableto 1 was lost when merging into vanilla,h_nr_runnableis now 0 for every dequeue, which breaks logic consumingh_nr_runnable.Bring back the adjustment for
h_nr_runnable.[1] https://lore.kernel.org/all/[email protected]/
Fixes 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")Reported-by kernel test robot <[email protected]>Signed-off-by Chen Yu <[email protected]>--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/sched/fair.c +0
-0
kernel/sched/fair.c static void dequeue_hierarchy(struct task_struct *p, int flags) · line 8245
Quoted 5 lines
kernel/sched/fair.c +1
-1@@ -8242,7 +8242,7 @@ static void dequeue_hierarchy(struct task_struct *p, int flags) {struct sched_entity *se = &p->se;bool task_throttled = flags &DEQUEUE_THROTTLE ; -int h_nr_runnable =0 ; +int h_nr_runnable =1 ;
Sorry for not spotting that earlier on the tip! Feel free to include:
Quoted 3 lines
kernel/sched/fair.c +0
-0int h_nr_idle =task_has_idle_policy (p);bool dequeue = true;
Signature · 2 lines
Thanks and Regards, Prateek
Vincent Guittot
maintainerQuoted 38 lines · K Prateek Nayak
Hello Chenyu,
Quoted 34 lines · Chen Yu
I fed this to AI and asked it to reproduced it on a server, later AI told me:
kernel/sched/fair.c +1
-1-int h_nr_runnable =0 ; +int h_nr_runnable =1 ;was missing in
dequeue_hierarchy()from https://lore.kernel.org/all/[email protected]/
when merging into486c3d06b902From
850d8788c72d6ae459034b85584cd5ea01df920eMon Sep 17 00:00:00 2001
From: Chen Yu <[email protected]>
Date: Mon, 23 Nov 2026 14:27:20 +0800
Subject: [PATCH] sched/fair: Fixh_nr_runnableleak indequeue_hierarchy()commit
486c3d06b902("sched/fair: Avoid transient double accounting for delayed tasks") changed the default ofh_nr_runnableindequeue_hierarchy()from 0 to 1 and only cleared it for an already delayed entity:int h_nr_runnable = 1; ... /* Already accounted via set_delayed(). */ if (se->sched_delayed) h_nr_runnable = 0;The adjust of
h_nr_runnableto 1 was lost when merging into vanilla,h_nr_runnableis now 0 for every dequeue, which breaks logic consumingh_nr_runnable.Bring back the adjustment for
h_nr_runnable.[1] https://lore.kernel.org/all/[email protected]/
Fixes 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")Reported-by kernel test robot <[email protected]>Signed-off-by Chen Yu <[email protected]>
There is a similar patch on the mailing list at
https://lore.kernel.org/all/[email protected]/
Quoted 27 lines
Quoted 9 lines
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/sched/fair.c +0
-0kernel/sched/fair.c static void dequeue_hierarchy(struct task_struct *p, int flags) · line 8245
Quoted 5 lines
kernel/sched/fair.c +1
-1@@ -8242,7 +8242,7 @@ static void dequeue_hierarchy(struct task_struct *p, int flags) {struct sched_entity *se = &p->se;bool task_throttled = flags &DEQUEUE_THROTTLE ; -int h_nr_runnable =0 ; +int h_nr_runnable =1 ;Sorry for not spotting that earlier on the tip! Feel free to include:
Reviewed-by K Prateek Nayak <[email protected]>kernel/sched/fair.c static void dequeue_hierarchy(struct task_struct *p, int flags) · line 8248
Quoted 3 lines
kernel/sched/fair.c +0
-0int h_nr_idle =task_has_idle_policy (p);bool dequeue = true;--
Thanks and Regards,
Prateek
Quoted 35 lines · Vincent Guittot
Quoted 34 lines · K Prateek Nayak
Hello Chenyu,
Quoted 30 lines · Chen Yu
I fed this to AI and asked it to reproduced it on a server, later AI told me:
kernel/sched/fair.c +1
-1-int h_nr_runnable =0 ; +int h_nr_runnable =1 ;was missing in
dequeue_hierarchy()from https://lore.kernel.org/all/[email protected]/
when merging into486c3d06b902From
850d8788c72d6ae459034b85584cd5ea01df920eMon Sep 17 00:00:00 2001
From: Chen Yu <[email protected]>
Date: Mon, 23 Nov 2026 14:27:20 +0800
Subject: [PATCH] sched/fair: Fixh_nr_runnableleak indequeue_hierarchy()commit
486c3d06b902("sched/fair: Avoid transient double accounting for delayed tasks") changed the default ofh_nr_runnableindequeue_hierarchy()from 0 to 1 and only cleared it for an already delayed entity:int h_nr_runnable = 1; ... /* Already accounted via set_delayed(). */ if (se->sched_delayed) h_nr_runnable = 0;The adjust of
h_nr_runnableto 1 was lost when merging into vanilla,h_nr_runnableis now 0 for every dequeue, which breaks logic consumingh_nr_runnable.Bring back the adjustment for
h_nr_runnable.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Fixes 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")Reported-by kernel test robot <[email protected]>Signed-off-by Chen Yu <[email protected]>There is a similar patch on the mailing list at
https://lore.kernel.org/all/[email protected]/
Above fix was earlier, so I'd like to give the credit to him, let me reply to this patch with my Tested-by Thanks Prateek, would you mind also reply to that patch?
thanks,
Chenyu
Quoted 27 lines
Quoted 27 lines
Quoted 9 lines
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/sched/fair.c +0
-0kernel/sched/fair.c static void dequeue_hierarchy(struct task_struct *p, int flags) · line 8245
Quoted 5 lines
kernel/sched/fair.c +1
-1@@ -8242,7 +8242,7 @@ static void dequeue_hierarchy(struct task_struct *p, int flags) {struct sched_entity *se = &p->se;bool task_throttled = flags &DEQUEUE_THROTTLE ; -int h_nr_runnable =0 ; +int h_nr_runnable =1 ;Sorry for not spotting that earlier on the tip! Feel free to include:
Reviewed-by K Prateek Nayak <[email protected]>kernel/sched/fair.c static void dequeue_hierarchy(struct task_struct *p, int flags) · line 8248
Quoted 3 lines
kernel/sched/fair.c +0
-0int h_nr_idle =task_has_idle_policy (p);bool dequeue = true;--
Thanks and Regards,
Prateek