stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sched/fair: Fix fixed point arithmetic width for shares and effective load
@ 2016-12-19 20:27 Samuel Thibault
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2016-12-19 20:27 UTC (permalink / raw)
  To: stable; +Cc: Dietmar Eggemann, Peter Zijlstra, Mike Galbraith, Thomas Gleixner

Hello,

Please backport
commit ab522e33f91799661aad47bebb691f241a9f6bb8
('sched/fair: Fix fixed point arithmetic width for shares and effective load')
to 4.7 and 4.8.

It was apparently not backported as of 4.7.10 and 4.8.15, while it fixes
a huge performance regression in our tests, see the graphs between
19320.5 and 19451.5 on

http://starpu.gforge.inria.fr/testing/trunk/benchmarks/tasks_size_overhead_total_lws-200.png

which happened to be using a kernel without this fix.

FTR, here is the patch again.

Samuel

commit ab522e33f91799661aad47bebb691f241a9f6bb8
Author: Dietmar Eggemann <dietmar.eggemann@arm.com>
Date:   Mon Aug 22 15:00:41 2016 +0100

    sched/fair: Fix fixed point arithmetic width for shares and effective load
    
    Since commit:
    
      2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")
    
    we now have two different fixed point units for load:
    
    - 'shares' in calc_cfs_shares() has 20 bit fixed point unit on 64-bit
      kernels. Therefore use scale_load() on MIN_SHARES.
    
    - 'wl' in effective_load() has 10 bit fixed point unit. Therefore use
      scale_load_down() on tg->shares which has 20 bit fixed point unit on
      64-bit kernels.
    
    Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1471874441-24701-1-git-send-email-dietmar.eggemann@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8fb4d19..786ef94 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5017,9 +5017,9 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
 		 * wl = S * s'_i; see (2)
 		 */
 		if (W > 0 && w < W)
-			wl = (w * (long)tg->shares) / W;
+			wl = (w * (long)scale_load_down(tg->shares)) / W;
 		else
-			wl = tg->shares;
+			wl = scale_load_down(tg->shares);
 
 		/*
 		 * Per the above, wl is the new se->load.weight value; since

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

* sched/fair: Fix fixed point arithmetic width for shares and effective load
@ 2017-01-07 20:38 Samuel Thibault
  2017-01-08 11:29 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2017-01-07 20:38 UTC (permalink / raw)
  To: stable, Greg KH
  Cc: Dietmar Eggemann, Peter Zijlstra, Mike Galbraith, Thomas Gleixner

Hello,

Please backport
commit ab522e33f91799661aad47bebb691f241a9f6bb8
('sched/fair: Fix fixed point arithmetic width for shares and effective load')
to 4.8.

It was apparently not backported as of 4.8.16, while it fixes a huge
performance regression in our tests, see the graphs between 19320.5 and
19451.5 on

http://starpu.gforge.inria.fr/testing/trunk/benchmarks/tasks_size_overhead_total_lws-200.png

which happened to be using a kernel without this fix.

FTR, here is the patch again.

Samuel

commit ab522e33f91799661aad47bebb691f241a9f6bb8
Author: Dietmar Eggemann <dietmar.eggemann@arm.com>
Date:   Mon Aug 22 15:00:41 2016 +0100

    sched/fair: Fix fixed point arithmetic width for shares and effective load
    
    Since commit:
    
      2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")
    
    we now have two different fixed point units for load:
    
    - 'shares' in calc_cfs_shares() has 20 bit fixed point unit on 64-bit
      kernels. Therefore use scale_load() on MIN_SHARES.
    
    - 'wl' in effective_load() has 10 bit fixed point unit. Therefore use
      scale_load_down() on tg->shares which has 20 bit fixed point unit on
      64-bit kernels.
    
    Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1471874441-24701-1-git-send-email-dietmar.eggemann@arm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8fb4d19..786ef94 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5017,9 +5017,9 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
 		 * wl = S * s'_i; see (2)
 		 */
 		if (W > 0 && w < W)
-			wl = (w * (long)tg->shares) / W;
+			wl = (w * (long)scale_load_down(tg->shares)) / W;
 		else
-			wl = tg->shares;
+			wl = scale_load_down(tg->shares);
 
 		/*
 		 * Per the above, wl is the new se->load.weight value; since

 

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

* Re: sched/fair: Fix fixed point arithmetic width for shares and effective load
  2017-01-07 20:38 sched/fair: Fix fixed point arithmetic width for shares and effective load Samuel Thibault
@ 2017-01-08 11:29 ` Greg KH
  2017-01-08 11:32   ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2017-01-08 11:29 UTC (permalink / raw)
  To: Samuel Thibault, stable, Dietmar Eggemann, Peter Zijlstra,
	Mike Galbraith, Thomas Gleixner

On Sat, Jan 07, 2017 at 09:38:36PM +0100, Samuel Thibault wrote:
> Hello,
> 
> Please backport
> commit ab522e33f91799661aad47bebb691f241a9f6bb8
> ('sched/fair: Fix fixed point arithmetic width for shares and effective load')
> to 4.8.

As 4.8-stable is about to go end-of-life on Monday (tomorrow), can't you
just use 4.9 instead?

> It was apparently not backported as of 4.8.16, while it fixes a huge
> performance regression in our tests, see the graphs between 19320.5 and
> 19451.5 on
> 
> http://starpu.gforge.inria.fr/testing/trunk/benchmarks/tasks_size_overhead_total_lws-200.png
> 
> which happened to be using a kernel without this fix.
> 
> FTR, here is the patch again.
> 
> Samuel
> 
> commit ab522e33f91799661aad47bebb691f241a9f6bb8
> Author: Dietmar Eggemann <dietmar.eggemann@arm.com>
> Date:   Mon Aug 22 15:00:41 2016 +0100
> 
>     sched/fair: Fix fixed point arithmetic width for shares and effective load
>     
>     Since commit:
>     
>       2159197d6677 ("sched/core: Enable increased load resolution on 64-bit kernels")
>     
>     we now have two different fixed point units for load:
>     
>     - 'shares' in calc_cfs_shares() has 20 bit fixed point unit on 64-bit
>       kernels. Therefore use scale_load() on MIN_SHARES.
>     
>     - 'wl' in effective_load() has 10 bit fixed point unit. Therefore use
>       scale_load_down() on tg->shares which has 20 bit fixed point unit on
>       64-bit kernels.
>     
>     Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
>     Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>     Cc: Linus Torvalds <torvalds@linux-foundation.org>
>     Cc: Mike Galbraith <efault@gmx.de>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Cc: Thomas Gleixner <tglx@linutronix.de>
>     Link: http://lkml.kernel.org/r/1471874441-24701-1-git-send-email-dietmar.eggemann@arm.com
>     Signed-off-by: Ingo Molnar <mingo@kernel.org>

I would need an ack from the developers of the patch before I could take
this into a stable kernel, but again, it's a bit late for 4.8, so I
don't think we should worry about it anymore, do you?

thanks,

greg k-h

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

* Re: sched/fair: Fix fixed point arithmetic width for shares and effective load
  2017-01-08 11:29 ` Greg KH
@ 2017-01-08 11:32   ` Samuel Thibault
  2017-01-08 12:51     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2017-01-08 11:32 UTC (permalink / raw)
  To: Greg KH
  Cc: stable, Dietmar Eggemann, Peter Zijlstra, Mike Galbraith,
	Thomas Gleixner

Greg KH, on Sun 08 Jan 2017 12:29:18 +0100, wrote:
> On Sat, Jan 07, 2017 at 09:38:36PM +0100, Samuel Thibault wrote:
> > Please backport
> > commit ab522e33f91799661aad47bebb691f241a9f6bb8
> > ('sched/fair: Fix fixed point arithmetic width for shares and effective load')
> > to 4.8.
> 
> As 4.8-stable is about to go end-of-life on Monday (tomorrow),

Ah Ok.

> can't you just use 4.9 instead?

I can, but we have users which use various distributions. But since 4.8
goes end-of-life, I guess no distribution will use it and the problem is
indeed moot.

Thanks,
Samuel

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

* Re: sched/fair: Fix fixed point arithmetic width for shares and effective load
  2017-01-08 11:32   ` Samuel Thibault
@ 2017-01-08 12:51     ` Greg KH
  2017-01-08 12:52       ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2017-01-08 12:51 UTC (permalink / raw)
  To: Samuel Thibault, stable, Dietmar Eggemann, Peter Zijlstra,
	Mike Galbraith, Thomas Gleixner

On Sun, Jan 08, 2017 at 12:32:48PM +0100, Samuel Thibault wrote:
> Greg KH, on Sun 08 Jan 2017 12:29:18 +0100, wrote:
> > On Sat, Jan 07, 2017 at 09:38:36PM +0100, Samuel Thibault wrote:
> > > Please backport
> > > commit ab522e33f91799661aad47bebb691f241a9f6bb8
> > > ('sched/fair: Fix fixed point arithmetic width for shares and effective load')
> > > to 4.8.
> > 
> > As 4.8-stable is about to go end-of-life on Monday (tomorrow),
> 
> Ah Ok.
> 
> > can't you just use 4.9 instead?
> 
> I can, but we have users which use various distributions.

What distros are stuck on 4.8 that are not going to be moving to 4.9
within a week or so that you care about?

thanks,

greg k-h

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

* Re: sched/fair: Fix fixed point arithmetic width for shares and effective load
  2017-01-08 12:51     ` Greg KH
@ 2017-01-08 12:52       ` Samuel Thibault
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2017-01-08 12:52 UTC (permalink / raw)
  To: Greg KH
  Cc: stable, Dietmar Eggemann, Peter Zijlstra, Mike Galbraith,
	Thomas Gleixner

Greg KH, on Sun 08 Jan 2017 13:51:22 +0100, wrote:
> On Sun, Jan 08, 2017 at 12:32:48PM +0100, Samuel Thibault wrote:
> > Greg KH, on Sun 08 Jan 2017 12:29:18 +0100, wrote:
> > > On Sat, Jan 07, 2017 at 09:38:36PM +0100, Samuel Thibault wrote:
> > > > Please backport
> > > > commit ab522e33f91799661aad47bebb691f241a9f6bb8
> > > > ('sched/fair: Fix fixed point arithmetic width for shares and effective load')
> > > > to 4.8.
> > > 
> > > As 4.8-stable is about to go end-of-life on Monday (tomorrow),
> > 
> > Ah Ok.
> > 
> > > can't you just use 4.9 instead?
> > 
> > I can, but we have users which use various distributions.
> 
> What distros are stuck on 4.8 that are not going to be moving to 4.9
> within a week or so that you care about?

I don't know, but there are so many of them that you never know :)

But given 4.8 is end-of-line, I now guess there won't be any.

Samuel

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

end of thread, other threads:[~2017-01-08 12:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-07 20:38 sched/fair: Fix fixed point arithmetic width for shares and effective load Samuel Thibault
2017-01-08 11:29 ` Greg KH
2017-01-08 11:32   ` Samuel Thibault
2017-01-08 12:51     ` Greg KH
2017-01-08 12:52       ` Samuel Thibault
  -- strict thread matches above, loose matches on Subject: below --
2016-12-19 20:27 Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).