diff options
author | Christoph Hellwig <hch@lst.de> | 2007-07-25 07:31:09 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-26 02:17:56 -0400 |
commit | 9d78592ed72dbff1d8825207f8def07858a49768 (patch) | |
tree | 5c585a6e5500b943301e0a30a31b432c08bb9b65 /arch/powerpc | |
parent | 6f6a6dc0c8ebdb6514ab6bb58ba4b8739957b342 (diff) |
[POWERPC] spusched: Fix initial timeslice calculation
Currently we calculate the first timeslice for every context
incorrectly - alloc_spu_context calls spu_set_timeslice before we set
ctx->prio so we always calculate the longest possible timeslice for the
lowest possible priority.
This patch makes sure to update the schedule-related fields before
calculating the timeslice and also makes sure we update the timeslice for
a non-running context when entering spu_run so a priority change affects
the context as soon as possible.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/context.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/run.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c index 6694f86d7000..9cb081c26e71 100644 --- a/arch/powerpc/platforms/cell/spufs/context.c +++ b/arch/powerpc/platforms/cell/spufs/context.c | |||
@@ -59,7 +59,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang) | |||
59 | INIT_LIST_HEAD(&ctx->aff_list); | 59 | INIT_LIST_HEAD(&ctx->aff_list); |
60 | if (gang) | 60 | if (gang) |
61 | spu_gang_add_ctx(gang, ctx); | 61 | spu_gang_add_ctx(gang, ctx); |
62 | ctx->cpus_allowed = current->cpus_allowed; | 62 | |
63 | __spu_update_sched_info(ctx); | ||
63 | spu_set_timeslice(ctx); | 64 | spu_set_timeslice(ctx); |
64 | ctx->stats.util_state = SPU_UTIL_IDLE_LOADED; | 65 | ctx->stats.util_state = SPU_UTIL_IDLE_LOADED; |
65 | 66 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index 0b50fa5cb39d..6abdd8fe2098 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c | |||
@@ -312,6 +312,7 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) | |||
312 | spu_acquire(ctx); | 312 | spu_acquire(ctx); |
313 | if (ctx->state == SPU_STATE_SAVED) { | 313 | if (ctx->state == SPU_STATE_SAVED) { |
314 | __spu_update_sched_info(ctx); | 314 | __spu_update_sched_info(ctx); |
315 | spu_set_timeslice(ctx); | ||
315 | 316 | ||
316 | ret = spu_activate(ctx, 0); | 317 | ret = spu_activate(ctx, 0); |
317 | if (ret) { | 318 | if (ret) { |
@@ -322,6 +323,9 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) | |||
322 | /* | 323 | /* |
323 | * We have to update the scheduling priority under active_mutex | 324 | * We have to update the scheduling priority under active_mutex |
324 | * to protect against find_victim(). | 325 | * to protect against find_victim(). |
326 | * | ||
327 | * No need to update the timeslice ASAP, it will get updated | ||
328 | * once the current one has expired. | ||
325 | */ | 329 | */ |
326 | spu_update_sched_info(ctx); | 330 | spu_update_sched_info(ctx); |
327 | } | 331 | } |