[Cbe-oss-dev] PATCH [3/7] reorganize spu_run_init

Christoph Hellwig hch at lst.de
Thu Nov 1 21:10:31 EST 2007


On Wed, Oct 31, 2007 at 09:07:16PM -0300, Luke Browning wrote:
> 
> This patch cleans up spu_run_init so that it does all of the spu initialization
> for spufs_run_spu.  It initializes the spu context as much as possible before
> it activates the spu and writes the runcntl register. 

Looks good.


>  static int __node_allowed(struct spu_context *ctx, int node)
> @@ -604,6 +615,10 @@ static struct spu *find_victim(struct sp
>  			 * higher priority contexts before lower priority
>  			 * ones, so this is safe until we introduce
>  			 * priority inheritance schemes.
> +			 *
> +			 * XXX if the highest priority context is locked,
> +			 * this can loop a long time.  Might be better to
> +			 * look at another context or give up after X retries.
>  			 */
>  			if (!mutex_trylock(&victim->state_mutex)) {
>  				victim = NULL;
> @@ -611,10 +626,10 @@ static struct spu *find_victim(struct sp
>  			}
>  
>  			spu = victim->spu;
> -			if (!spu) {
> +			if (!spu || victim->prio <= ctx->prio) {
>  				/*
>  				 * This race can happen because we've dropped
> -				 * the active list mutex.  No a problem, just
> +				 * the active list mutex.  Not a problem, just
>  				 * restart the search.

This should probably be a patch of it's own.

> @@ -873,7 +888,7 @@ static void spusched_wake(unsigned long 

>  static int spusched_thread(void *unused)
>  {
> -	struct spu *spu, *next;
> +	struct spu *spu;
>  	int node;
>  
>  	while (!kthread_should_stop()) {
> @@ -973,7 +988,7 @@ int __init spu_sched_init(void)
>  
>  void __exit spu_sched_exit(void)
>  {
> -	struct spu *spu, *tmp;
> +	struct spu *spu;
>  	int node;

These two hunks are warning fixes that don't belong in here but in a
separate fix.  In fact I'm pretty sure I had submitted this long
time ago..



More information about the cbe-oss-dev mailing list