mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [linus:master] [sched/fair]  486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression
@ 2026-11-23  0:47 kernel test robot
  2026-11-23  6:56 ` Chen Yu
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2026-11-23  0:47 UTC (permalink / raw)
  To: K Prateek Nayak
  Cc: oe-lkp, lkp, linux-kernel, Peter Zijlstra, Vincent Guittot,
	aubrey.li, yu.c.chen, yi1.lai


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 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 <yi1.lai@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202611230853.e2e6401-lkp@intel.com


Details are as below:
-------------------------------------------------------------------------------------------------->


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20261123/202611230853.e2e6401-lkp@intel.com

=========================================================================================
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_switches


Disclaimer:
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.


-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



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

* Re: [linus:master] [sched/fair]  486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression
  2026-11-23  0:47 [linus:master] [sched/fair] 486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression kernel test robot
@ 2026-11-23  6:56 ` Chen Yu
  2026-11-23  7:16   ` K Prateek Nayak
  0 siblings, 1 reply; 5+ messages in thread
From: Chen Yu @ 2026-11-23  6:56 UTC (permalink / raw)
  To: kernel test robot, K Prateek Nayak, Peter Zijlstra
  Cc: K Prateek Nayak, oe-lkp, lkp, linux-kernel, Peter Zijlstra,
	Vincent Guittot, aubrey.li

On Mon, Nov 23, 2026 at 08:47:54AM +0800, kernel test robot wrote:
> 
> 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 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 <yi1.lai@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202611230853.e2e6401-lkp@intel.com

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/20261112083447.25603-1-kprateek.nayak@amd.com/
when merging into 486c3d06b902

From 850d8788c72d6ae459034b85584cd5ea01df920e Mon Sep 17 00:00:00 2001
From: Chen Yu <yu.c.chen@intel.com>
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/20261112083447.25603-1-kprateek.nayak@amd.com/

Fixes: 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")
Reported-by: kernel test robot <yi1.lai@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202611230853.e2e6401-lkp@intel.com
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index da0d9e19c457..8a55571b9719 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -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;
 
-- 
2.25.1


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

* Re: [linus:master] [sched/fair] 486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression
  2026-11-23  6:56 ` Chen Yu
@ 2026-11-23  7:16   ` K Prateek Nayak
  2026-11-23  7:48     ` Vincent Guittot
  0 siblings, 1 reply; 5+ messages in thread
From: K Prateek Nayak @ 2026-11-23  7:16 UTC (permalink / raw)
  To: Chen Yu, kernel test robot, Peter Zijlstra
  Cc: oe-lkp, lkp, linux-kernel, Vincent Guittot, aubrey.li

Hello Chenyu,

On 11/23/2026 12:26 PM, Chen Yu wrote:
> 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/20261112083447.25603-1-kprateek.nayak@amd.com/
> when merging into 486c3d06b902
> 
> From 850d8788c72d6ae459034b85584cd5ea01df920e Mon Sep 17 00:00:00 2001
> From: Chen Yu <yu.c.chen@intel.com>
> 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/20261112083447.25603-1-kprateek.nayak@amd.com/
> 
> Fixes: 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")
> Reported-by: kernel test robot <yi1.lai@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202611230853.e2e6401-lkp@intel.com
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
>  kernel/sched/fair.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index da0d9e19c457..8a55571b9719 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -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 <kprateek.nayak@amd.com>

>  	int h_nr_idle = task_has_idle_policy(p);
>  	bool dequeue = true;
>  

-- 
Thanks and Regards,
Prateek


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

* Re: [linus:master] [sched/fair] 486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression
  2026-11-23  7:16   ` K Prateek Nayak
@ 2026-11-23  7:48     ` Vincent Guittot
  2026-11-23  7:53       ` Chen Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Guittot @ 2026-11-23  7:48 UTC (permalink / raw)
  To: K Prateek Nayak
  Cc: Chen Yu, kernel test robot, Peter Zijlstra, oe-lkp, lkp,
	linux-kernel, aubrey.li

On Mon, 23 Nov 2026 at 08:16, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
>
> Hello Chenyu,
>
> On 11/23/2026 12:26 PM, Chen Yu wrote:
> > 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/20261112083447.25603-1-kprateek.nayak@amd.com/
> > when merging into 486c3d06b902
> >
> > From 850d8788c72d6ae459034b85584cd5ea01df920e Mon Sep 17 00:00:00 2001
> > From: Chen Yu <yu.c.chen@intel.com>
> > 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/20261112083447.25603-1-kprateek.nayak@amd.com/
> >
> > Fixes: 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")
> > Reported-by: kernel test robot <yi1.lai@intel.com>
> > Closes: https://lore.kernel.org/oe-lkp/202611230853.e2e6401-lkp@intel.com
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>

There is a similar patch on the mailing list at
https://lore.kernel.org/all/20261123001213.7609-1-prabhakar.mahadev-lad.rj@bp.renesas.com/

> > ---
> >  kernel/sched/fair.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index da0d9e19c457..8a55571b9719 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -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 <kprateek.nayak@amd.com>
>
> >       int h_nr_idle = task_has_idle_policy(p);
> >       bool dequeue = true;
> >
>
> --
> Thanks and Regards,
> Prateek
>

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

* Re: [linus:master] [sched/fair] 486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression
  2026-11-23  7:48     ` Vincent Guittot
@ 2026-11-23  7:53       ` Chen Yu
  0 siblings, 0 replies; 5+ messages in thread
From: Chen Yu @ 2026-11-23  7:53 UTC (permalink / raw)
  To: Vincent Guittot, K Prateek Nayak
  Cc: K Prateek Nayak, kernel test robot, Peter Zijlstra, oe-lkp, lkp,
	linux-kernel, aubrey.li

On Mon, Nov 23, 2026 at 08:48:08AM +0100, Vincent Guittot wrote:
> On Mon, 23 Nov 2026 at 08:16, K Prateek Nayak <kprateek.nayak@amd.com> wrote:
> >
> > Hello Chenyu,
> >
> > On 11/23/2026 12:26 PM, Chen Yu wrote:
> > > 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/20261112083447.25603-1-kprateek.nayak@amd.com/
> > > when merging into 486c3d06b902
> > >
> > > From 850d8788c72d6ae459034b85584cd5ea01df920e Mon Sep 17 00:00:00 2001
> > > From: Chen Yu <yu.c.chen@intel.com>
> > > 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/20261112083447.25603-1-kprateek.nayak@amd.com/
> > >
> > > Fixes: 486c3d06b902 ("sched/fair: Avoid transient double accounting for delayed tasks")
> > > Reported-by: kernel test robot <yi1.lai@intel.com>
> > > Closes: https://lore.kernel.org/oe-lkp/202611230853.e2e6401-lkp@intel.com
> > > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> 
> There is a similar patch on the mailing list at
> https://lore.kernel.org/all/20261123001213.7609-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
>

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
 
> > > ---
> > >  kernel/sched/fair.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > > index da0d9e19c457..8a55571b9719 100644
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -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 <kprateek.nayak@amd.com>
> >
> > >       int h_nr_idle = task_has_idle_policy(p);
> > >       bool dequeue = true;
> > >
> >
> > --
> > Thanks and Regards,
> > Prateek
> >

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

end of thread, other threads:[~2026-11-23  8:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  0:47 [linus:master] [sched/fair] 486c3d06b9: stress-ng.switch.ops_per_sec 33.3% regression kernel test robot
2026-11-23  6:56 ` Chen Yu
2026-11-23  7:16   ` K Prateek Nayak
2026-11-23  7:48     ` Vincent Guittot
2026-11-23  7:53       ` Chen Yu

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

all inboxes | Powered by JetHome®