[Cbe-oss-dev] [PATCH] spufs: don't yield CPU in spu_yield

Luke Browning lukebr at linux.vnet.ibm.com
Mon Mar 26 05:37:18 EST 2007


On Fri, 2007-03-23 at 15:12 +0100, Christoph Hellwig wrote:
> There is no reason to yield the SPU in spu_yield - if the backing
> thread reenters spu_run it gets added to the end of the runqueue for
> it's priority.  So the yield is just a slowdown for the case where
> we have higher priority contexts waiting.
> 
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> 
> Index: linux-2.6/arch/powerpc/platforms/cell/spufs/sched.c
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/sched.c	2007-03-21 17:07:27.000000000 +0100
> +++ linux-2.6/arch/powerpc/platforms/cell/spufs/sched.c	2007-03-21 17:07:44.000000000 +0100
> @@ -498,7 +498,6 @@ void spu_deactivate(struct spu_context *
>  void spu_yield(struct spu_context *ctx)
>  {
>  	struct spu *spu;
> -	int need_yield = 0;
> 
>  	if (mutex_trylock(&ctx->state_mutex)) {
>  		if ((spu = ctx->spu) != NULL) {
> @@ -507,13 +506,10 @@ void spu_yield(struct spu_context *ctx)
>  				pr_debug("%s: yielding SPU %d NODE %d\n",
>  					 __FUNCTION__, spu->number, spu->node);
>  				spu_deactivate(ctx);
> -				need_yield = 1;
>  			}
>  		}
>  		mutex_unlock(&ctx->state_mutex);

I believe the state_mutex is held by the caller, so this routine does
nothing.

Luke






More information about the cbe-oss-dev mailing list