<html><body>
<p><tt>cbe-oss-dev-bounces+lukebrowning=us.ibm.com@ozlabs.org wrote on 02/09/2007 01:47:29 PM:<br>
<br>
> On Fri, Feb 09, 2007 at 12:43:01AM +0100, Christoph Hellwig wrote:<br>
> > If we start a spu context with realtime priority we want it to run<br>
> > immediately and not wait until some other lower priority thread has<br>
> > finished. Try to find a suitable victim and use it's spu in this<br>
> > case.<br>
> <br>
> Due to a mistake in my quilt usage this is missing the changes to<br>
> context.c and spufs.h. The full patch is below:<br>
> <br>
> Index: linux-2.6/arch/powerpc/platforms/cell/spufs/sched.c<br>
> ===================================================================<br>
> --- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/sched.c <br>
> 2007-02-09 16:08:51.000000000 +0100<br>
> +++ linux-2.6/arch/powerpc/platforms/cell/spufs/sched.c 2007-02-09<br>
> 16:08:57.000000000 +0100<br>
> @@ -282,6 +282,74 @@<br>
> }<br>
> <br>
> /**<br>
> + * find_victim - find a lower priority context to preempt<br>
> + * @ctx: canidate context for running<br>
> + *<br>
> + * Returns the freed physical spu to run the new context on.<br>
> + */<br>
> +static struct spu *find_victim(struct spu_context *ctx)<br>
> +{<br>
> + struct spu_context *victim = NULL;<br>
> + struct spu *spu;<br>
> + int node, n;<br>
> +<br>
> + /*<br>
> + * Look for a possible preemption candidate on the local node first.<br>
> + * If there is no candidate look at the other nodes. This isn't<br>
> + * exactly fair, but so far the whole spu schedule tries to keep<br>
> + * a strong node affinity. We might want to fine-tune this in<br>
> + * the future.<br>
> + */<br>
> + restart:<br>
> + node = cpu_to_node(raw_smp_processor_id());<br>
> + for (n = 0; n < MAX_NUMNODES; n++, node++) {<br>
> + node = (node < MAX_NUMNODES) ? node : 0;<br>
> + if (!node_allowed(node))<br>
> + continue;<br>
> +<br>
> + mutex_lock(&spu_prio->active_mutex[node]);<br>
> + list_for_each_entry(spu, &spu_prio->active_list[node], list) {<br>
> + struct spu_context *tmp = spu->ctx;<br>
> +<br>
> + if (tmp->rt_priority < ctx->rt_priority &&<br>
> + (!victim || tmp->rt_priority < victim->rt_priority))<br>
> + victim = spu->ctx;<br>
> + }<br>
</tt><br>
<br>
<tt>You really want to preempt sched_other jobs before fixed priority jobs. Does the</tt><br>
<tt>above consider sched_other jobs. what is the relationship between prio and rt_priority?</tt><br>
<br>
<tt>Luke</tt></body></html>