aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-04-23 15:08:08 -0400
committerArnd Bergmann <arnd@klappe.arndb.de>2007-04-23 15:18:53 -0400
commitb3e76cc3244ac139fc75750c5af9edbb9f191a10 (patch)
treee4d743216dceb19155ea0f374ee445e9a6a8a7e7 /arch
parent43c2bbd932b66403688f3d812065d82f8fb8f4b3 (diff)
[POWERPC] spu sched: ensure preempted threads are put back on the runqueue
To not lose a spu thread we need to make sure it always gets put back on the runqueue. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 003e330fc76f..5149dff65c9e 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -97,7 +97,7 @@ void spu_sched_tick(struct work_struct *work)
97 struct spu_context *ctx = 97 struct spu_context *ctx =
98 container_of(work, struct spu_context, sched_work.work); 98 container_of(work, struct spu_context, sched_work.work);
99 struct spu *spu; 99 struct spu *spu;
100 int rearm = 1; 100 int preempted = 0;
101 101
102 /* 102 /*
103 * If this context is being stopped avoid rescheduling from the 103 * If this context is being stopped avoid rescheduling from the
@@ -113,12 +113,19 @@ void spu_sched_tick(struct work_struct *work)
113 int best = sched_find_first_bit(spu_prio->bitmap); 113 int best = sched_find_first_bit(spu_prio->bitmap);
114 if (best <= ctx->prio) { 114 if (best <= ctx->prio) {
115 spu_deactivate(ctx); 115 spu_deactivate(ctx);
116 rearm = 0; 116 preempted = 1;
117 } 117 }
118 } 118 }
119 mutex_unlock(&ctx->state_mutex); 119 mutex_unlock(&ctx->state_mutex);
120 120
121 if (rearm) 121 if (preempted) {
122 /*
123 * We need to break out of the wait loop in spu_run manually
124 * to ensure this context gets put on the runqueue again
125 * ASAP.
126 */
127 wake_up(&ctx->stop_wq);
128 } else
122 spu_start_tick(ctx); 129 spu_start_tick(ctx);
123} 130}
124 131