diff mbox

(no subject)

Message ID 200812101903.mBAJ38vv021705@d24av02.br.ibm.com
State Superseded
Headers show

Commit Message

Andre Detsch Dec. 10, 2008, 7:03 p.m. UTC
From 0a46b71f2caa52cfd2e6184112cb77deddbbb8bf Mon Sep 17 00:00:00 2001
In-Reply-To: <200812101654.05091.adetsch@br.ibm.com>
References: <200812101654.05091.adetsch@br.ibm.com>
From: Andre Detsch <adetsch@br.ibm.com>
Date: Wed, 10 Dec 2008 16:03:08 -0300
Subject: [PATCH 06/18] powerpc/spufs: Time slice lazily loaded contexts.
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200812101703.08583.adetsch@br.ibm.com>

All SPUs are stopped.  All contexts are either executing library
code or they have major faulted in spu_run.

Signed-off-by: Luke Browning <lukebrowning@us.ibm.com>
Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
---
 arch/powerpc/platforms/cell/spufs/sched.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

 		if (spu_prio->nr_waiting) {
diff mbox

Patch

diff --git a/arch/powerpc/platforms/cell/spufs/sched.c 
b/arch/powerpc/platforms/cell/spufs/sched.c
index 3c83bd3..acd584e 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -1244,9 +1244,13 @@  static noinline int spusched_tick(struct spu_gang 
*gang,
 		goto out;
 
 	/*
-	 * If nrunnable is zero, then all of the contexts are in user mode.
+	 * If nrunnable is zero, then all of the contexts are in user mode
+	 * and by definition nfaulting is equal to zero.  Otherwise if they
+	 * are equal, all of the contexts in spu_run have faulted.  In both
+	 * cases, all spus are stopped and we should yield assuming there
+	 * is another gang on the runqueue.
 	 */
-	yield = !atomic_read(&gang->nrunnable);
+	yield = atomic_read(&gang->nrunnable) == atomic_read(&gang->nfaulting);
 
 	if (yield || ((ctx->policy != SCHED_FIFO) && (!--ctx->time_slice))) {