diff options
author | Christoph Hellwig <hch@lst.de> | 2007-02-13 15:36:50 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@klappe.arndb.de> | 2007-02-13 15:52:37 -0500 |
commit | 650f8b0291ecd0abdeadbd0ff3d70c3538e55405 (patch) | |
tree | 3d3df208380ac7b2fafdd03b5fbcc01d2dedd934 /arch/powerpc/platforms/cell/spufs/sched.c | |
parent | 202557d29eae528f464652e92085f3b19b05a0a7 (diff) |
[POWERPC] spufs: simplify state_mutex
The r/w semaphore to lock the spus was overkill and can be replaced
with a mutex to make it faster, simpler and easier to debug. It also
helps to allow making most spufs interruptible in future patches.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/sched.c')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 1d330f67f5ae..c61a34b14083 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -233,11 +233,11 @@ static void spu_prio_wait(struct spu_context *ctx, u64 flags) | |||
233 | spu_add_wq(wq, &wait, prio); | 233 | spu_add_wq(wq, &wait, prio); |
234 | 234 | ||
235 | if (!signal_pending(current)) { | 235 | if (!signal_pending(current)) { |
236 | up_write(&ctx->state_sema); | 236 | mutex_unlock(&ctx->state_mutex); |
237 | pr_debug("%s: pid=%d prio=%d\n", __FUNCTION__, | 237 | pr_debug("%s: pid=%d prio=%d\n", __FUNCTION__, |
238 | current->pid, current->prio); | 238 | current->pid, current->prio); |
239 | schedule(); | 239 | schedule(); |
240 | down_write(&ctx->state_sema); | 240 | mutex_lock(&ctx->state_mutex); |
241 | } | 241 | } |
242 | 242 | ||
243 | spu_del_wq(wq, &wait, prio); | 243 | spu_del_wq(wq, &wait, prio); |
@@ -334,7 +334,7 @@ void spu_yield(struct spu_context *ctx) | |||
334 | struct spu *spu; | 334 | struct spu *spu; |
335 | int need_yield = 0; | 335 | int need_yield = 0; |
336 | 336 | ||
337 | if (down_write_trylock(&ctx->state_sema)) { | 337 | if (mutex_trylock(&ctx->state_mutex)) { |
338 | if ((spu = ctx->spu) != NULL) { | 338 | if ((spu = ctx->spu) != NULL) { |
339 | int best = sched_find_first_bit(spu_prio->bitmap); | 339 | int best = sched_find_first_bit(spu_prio->bitmap); |
340 | if (best < MAX_PRIO) { | 340 | if (best < MAX_PRIO) { |
@@ -346,7 +346,7 @@ void spu_yield(struct spu_context *ctx) | |||
346 | spu->prio = MAX_PRIO; | 346 | spu->prio = MAX_PRIO; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | up_write(&ctx->state_sema); | 349 | mutex_unlock(&ctx->state_mutex); |
350 | } | 350 | } |
351 | if (unlikely(need_yield)) | 351 | if (unlikely(need_yield)) |
352 | yield(); | 352 | yield(); |