[Cbe-oss-dev] Gang scheduling [RFC] [PATCH 6:9] yield

Luke Browning lukebr at linux.vnet.ibm.com
Sat Mar 15 07:59:57 EST 2008


Time slice lazily loaded contexts.

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 at us.ibm.com>

---

Index: public_git/arch/powerpc/platforms/cell/spufs/sched.c
===================================================================
--- public_git.orig/arch/powerpc/platforms/cell/spufs/sched.c	2008-03-14 17:08:31.000000000 -0300
+++ public_git/arch/powerpc/platforms/cell/spufs/sched.c	2008-03-14 17:08:39.000000000 -0300
@@ -1185,9 +1185,13 @@
 		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))) {
 		if (spu_prio->nr_waiting) {





More information about the cbe-oss-dev mailing list