mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RT] Fix RT balancing tasks pulling
@ 2007-07-24 13:42 Sébastien Dugué
  2007-07-25  7:27 ` Ingo Molnar
  2007-07-30 21:50 ` Josh Triplett
  0 siblings, 2 replies; 5+ messages in thread
From: Sébastien Dugué @ 2007-07-24 13:42 UTC (permalink / raw)
  To: Linux RT Users
  Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, Jean Pierre Dion,
	Darren Hart, john stultz, Josh Triplett



  Hi Ingo, Thomas,

  this one-liner fixes a bug in balance_rt_tasks() which sometimes manifests by
having a lower prio task being scheduled while a higher prio task is sitting
waiting on another runqueue.

  This is pretty hard to reproduce on low cpu count machines, for example, I
had to have sched_football run in a loop for ~38h before it failed on a dual HT
Xeon box.

  Sébastien.

---


  In the CPU loop in balance_rt_tasks(), the 'next' task pointer is only ever
updated if this_rq->lock has been dropped in double_lock_balance().

  This sometimes lead to 'this_cpu' pulling tasks that are only garanteed to
have a higher priority than the 'next' picked before the loop.

  Fix this to update 'next' to the last picked RT task.


Signed-off-by: Sébastien Dugué <sebastien.dugue@bull.net>

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

Index: linux-2.6.22.1-rt6/kernel/sched.c
===================================================================
--- linux-2.6.22.1-rt6.orig/kernel/sched.c	2007-07-24 11:34:18.000000000 +0200
+++ linux-2.6.22.1-rt6/kernel/sched.c	2007-07-24 11:34:35.000000000 +0200
@@ -1499,6 +1499,14 @@ static void balance_rt_tasks(struct rq *
 			 * in another runqueue. (low likelyhood
 			 * but possible)
 			 */
+
+			/*
+			 * Update next so that we won't pick a task
+			 * on another cpu with a priority lower (or equal)
+			 * than the one we just picked.
+			 */
+			next = p;
+
 		}
 		spin_unlock(&src_rq->lock);
 	}

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

* Re: [PATCH RT] Fix RT balancing tasks pulling
  2007-07-24 13:42 [PATCH RT] Fix RT balancing tasks pulling Sébastien Dugué
@ 2007-07-25  7:27 ` Ingo Molnar
  2007-07-30 21:50 ` Josh Triplett
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2007-07-25  7:27 UTC (permalink / raw)
  To: Sébastien Dugué
  Cc: Linux RT Users, linux-kernel, Thomas Gleixner, Jean Pierre Dion,
	Darren Hart, john stultz, Josh Triplett


* Sébastien Dugué <sebastien.dugue@bull.net> wrote:

>   Hi Ingo, Thomas,
> 
>   this one-liner fixes a bug in balance_rt_tasks() which sometimes 
> manifests by having a lower prio task being scheduled while a higher 
> prio task is sitting waiting on another runqueue.
> 
>   This is pretty hard to reproduce on low cpu count machines, for 
> example, I had to have sched_football run in a loop for ~38h before it 
> failed on a dual HT Xeon box.

really nice catch! Applied.

	Ingo

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

* Re: [PATCH RT] Fix RT balancing tasks pulling
  2007-07-24 13:42 [PATCH RT] Fix RT balancing tasks pulling Sébastien Dugué
  2007-07-25  7:27 ` Ingo Molnar
@ 2007-07-30 21:50 ` Josh Triplett
  2007-07-31 11:48   ` Sébastien Dugué
  1 sibling, 1 reply; 5+ messages in thread
From: Josh Triplett @ 2007-07-30 21:50 UTC (permalink / raw)
  To: Sébastien Dugué
  Cc: Linux RT Users, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Jean Pierre Dion, Darren Hart, john stultz

On Tue, 2007-07-24 at 15:42 +0200, Sébastien Dugué wrote:
>   this one-liner fixes a bug in balance_rt_tasks() which sometimes manifests by
> having a lower prio task being scheduled while a higher prio task is sitting
> waiting on another runqueue.
> 
>   This is pretty hard to reproduce on low cpu count machines, for example, I
> had to have sched_football run in a loop for ~38h before it failed on a dual HT
> Xeon box.

Very impressive find, and this does seem to improve things in some
cases.

However, with 2.6.22.1-rt8, which includes this patch, I still managed
to get some failures after a few hours on an 8-way (quad dual-core) box.
Preliminary results so far:
    420 Final ball position: 0
      2 Final ball position: 1

- Josh Triplett



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

* Re: [PATCH RT] Fix RT balancing tasks pulling
  2007-07-30 21:50 ` Josh Triplett
@ 2007-07-31 11:48   ` Sébastien Dugué
  2007-08-01  0:18     ` Josh Triplett
  0 siblings, 1 reply; 5+ messages in thread
From: Sébastien Dugué @ 2007-07-31 11:48 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Linux RT Users, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Jean Pierre Dion, Darren Hart, john stultz


  Hi Josh,

On Mon, 30 Jul 2007 14:50:34 -0700 Josh Triplett <josht@linux.vnet.ibm.com> wrote:

> On Tue, 2007-07-24 at 15:42 +0200, Sébastien Dugué wrote:
> >   this one-liner fixes a bug in balance_rt_tasks() which sometimes manifests by
> > having a lower prio task being scheduled while a higher prio task is sitting
> > waiting on another runqueue.
> > 
> >   This is pretty hard to reproduce on low cpu count machines, for example, I
> > had to have sched_football run in a loop for ~38h before it failed on a dual HT
> > Xeon box.
> 
> Very impressive find, and this does seem to improve things in some
> cases.
> 
> However, with 2.6.22.1-rt8, which includes this patch, I still managed
> to get some failures after a few hours on an 8-way (quad dual-core) box.
> Preliminary results so far:
>     420 Final ball position: 0
>       2 Final ball position: 1
> 

  Darn, I thought it was it :(

  I had a ~60h run on my box with the very same kernel without a single
failure.

  Do you have any other user RT load running when those failures pop up?

  Anyway, back to scheduler code dissection now.

  Sébastien.

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

* Re: [PATCH RT] Fix RT balancing tasks pulling
  2007-07-31 11:48   ` Sébastien Dugué
@ 2007-08-01  0:18     ` Josh Triplett
  0 siblings, 0 replies; 5+ messages in thread
From: Josh Triplett @ 2007-08-01  0:18 UTC (permalink / raw)
  To: Sébastien Dugué
  Cc: Linux RT Users, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Jean Pierre Dion, Darren Hart, john stultz

On Tue, 2007-07-31 at 13:48 +0200, Sébastien Dugué wrote:
> On Mon, 30 Jul 2007 14:50:34 -0700 Josh Triplett <josht@linux.vnet.ibm.com> wrote:
> > On Tue, 2007-07-24 at 15:42 +0200, Sébastien Dugué wrote:
> > >   this one-liner fixes a bug in balance_rt_tasks() which sometimes manifests by
> > > having a lower prio task being scheduled while a higher prio task is sitting
> > > waiting on another runqueue.
> > > 
> > >   This is pretty hard to reproduce on low cpu count machines, for example, I
> > > had to have sched_football run in a loop for ~38h before it failed on a dual HT
> > > Xeon box.
> > 
> > Very impressive find, and this does seem to improve things in some
> > cases.
> > 
> > However, with 2.6.22.1-rt8, which includes this patch, I still managed
> > to get some failures after a few hours on an 8-way (quad dual-core) box.
> > Preliminary results so far:
> >     420 Final ball position: 0
> >       2 Final ball position: 1
> > 
> 
>   Darn, I thought it was it :(
> 
>   I had a ~60h run on my box with the very same kernel without a single
> failure.

I think you really need a box with more processors to reproduce these
problems in a reasonable timeframe.  Happy to test any patches you have
to fix RT balancing; please let me know.

>   Do you have any other user RT load running when those failures pop up?

Other than sched_football, I had sshd, bash, and GNU screen,
theoretically all 100% idle (no input to read and no output to display).

- Josh Triplett



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

end of thread, other threads:[~2007-08-01  0:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-24 13:42 [PATCH RT] Fix RT balancing tasks pulling Sébastien Dugué
2007-07-25  7:27 ` Ingo Molnar
2007-07-30 21:50 ` Josh Triplett
2007-07-31 11:48   ` Sébastien Dugué
2007-08-01  0:18     ` Josh Triplett

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®