diff options
author | Christoph Hellwig <hch@lst.de> | 2007-06-28 20:57:55 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-03 01:24:45 -0400 |
commit | 2cf2b3b49f10d2f4a0703070fc54ce1cd84a6cda (patch) | |
tree | d8b19ec2df628df8b5b10e2ac4576c28d51b9548 /arch/powerpc/platforms/cell/spufs/run.c | |
parent | f3f59bec0c7ad083e9c95a550bcb1e9ca27e25f4 (diff) |
[POWERPC] spusched: Update scheduling paramters on every spu_run
Update scheduling information on every spu_run to allow for setting
threads to realtime priority just before running them. This requires
some slightly ugly code in spufs_run_spu because we can just update
the information unlocked if the spu is not runnable, but we need to
acquire the active_mutex when it is runnable to protect against
find_victim. This locking scheme requires opencoding
spu_acquire_runnable in spufs_run_spu which actually is a nice cleanup
all by itself.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/run.c')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/run.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index 89b02b6bfc55..4e0db6ae0d5e 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c | |||
@@ -301,9 +301,22 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx, | |||
301 | ctx->ops->master_start(ctx); | 301 | ctx->ops->master_start(ctx); |
302 | ctx->event_return = 0; | 302 | ctx->event_return = 0; |
303 | 303 | ||
304 | ret = spu_acquire_runnable(ctx, 0); | 304 | spu_acquire(ctx); |
305 | if (ret) | 305 | if (ctx->state == SPU_STATE_SAVED) { |
306 | return ret; | 306 | __spu_update_sched_info(ctx); |
307 | |||
308 | ret = spu_activate(ctx, 0); | ||
309 | if (ret) { | ||
310 | spu_release(ctx); | ||
311 | goto out; | ||
312 | } | ||
313 | } else { | ||
314 | /* | ||
315 | * We have to update the scheduling priority under active_mutex | ||
316 | * to protect against find_victim(). | ||
317 | */ | ||
318 | spu_update_sched_info(ctx); | ||
319 | } | ||
307 | 320 | ||
308 | ret = spu_run_init(ctx, npc); | 321 | ret = spu_run_init(ctx, npc); |
309 | if (ret) { | 322 | if (ret) { |