summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/cell/spufs/run.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-07-25 21:31:09 +1000
committerPaul Mackerras <paulus@samba.org>2007-07-26 16:17:56 +1000
commit9d78592ed72dbff1d8825207f8def07858a49768 (patch)
tree5c585a6e5500b943301e0a30a31b432c08bb9b65 /arch/powerpc/platforms/cell/spufs/run.c
parent6f6a6dc0c8ebdb6514ab6bb58ba4b8739957b342 (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/platforms/cell/spufs/run.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c4
1 files changed, 4 insertions, 0 deletions
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)
spu_acquire(ctx);
if (ctx->state == SPU_STATE_SAVED) {
__spu_update_sched_info(ctx);
+ spu_set_timeslice(ctx);
ret = spu_activate(ctx, 0);
if (ret) {
@@ -322,6 +323,9 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event)
/*
* We have to update the scheduling priority under active_mutex
* to protect against find_victim().
+ *
+ * No need to update the timeslice ASAP, it will get updated
+ * once the current one has expired.
*/
spu_update_sched_info(ctx);
}