b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -1230,9 +1230,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))) {