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/sched.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/sched.c')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 002b40af4a77..3707c7fdbdee 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -96,6 +96,33 @@ void spu_set_timeslice(struct spu_context *ctx) | |||
96 | ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, ctx->prio); | 96 | ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, ctx->prio); |
97 | } | 97 | } |
98 | 98 | ||
99 | /* | ||
100 | * Update scheduling information from the owning thread. | ||
101 | */ | ||
102 | void __spu_update_sched_info(struct spu_context *ctx) | ||
103 | { | ||
104 | /* | ||
105 | * We do our own priority calculations, so we normally want | ||
106 | * ->static_prio to start with. Unfortunately thies field | ||
107 | * contains junk for threads with a realtime scheduling | ||
108 | * policy so we have to look at ->prio in this case. | ||
109 | */ | ||
110 | if (rt_prio(current->prio)) | ||
111 | ctx->prio = current->prio; | ||
112 | else | ||
113 | ctx->prio = current->static_prio; | ||
114 | ctx->policy = current->policy; | ||
115 | } | ||
116 | |||
117 | void spu_update_sched_info(struct spu_context *ctx) | ||
118 | { | ||
119 | int node = ctx->spu->node; | ||
120 | |||
121 | mutex_lock(&spu_prio->active_mutex[node]); | ||
122 | __spu_update_sched_info(ctx); | ||
123 | mutex_unlock(&spu_prio->active_mutex[node]); | ||
124 | } | ||
125 | |||
99 | static inline int node_allowed(int node) | 126 | static inline int node_allowed(int node) |
100 | { | 127 | { |
101 | cpumask_t mask; | 128 | cpumask_t mask; |