Browse Source

[POWERPC] spufs: spu_find_victim may choose wrong victim

Need to re-check priority after dropping lock.  Otherwise, a
more favored context may be preempted.

Signed-off-by: Luke Browning <lukebr@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Luke Browning 17 years ago
parent
commit
b192541b39
1 changed files with 2 additions and 2 deletions
  1. 2 2
      arch/powerpc/platforms/cell/spufs/sched.c

+ 2 - 2
arch/powerpc/platforms/cell/spufs/sched.c

@@ -626,10 +626,10 @@ static struct spu *find_victim(struct spu_context *ctx)
 			}
 			}
 
 
 			spu = victim->spu;
 			spu = victim->spu;
-			if (!spu) {
+			if (!spu || victim->prio <= ctx->prio) {
 				/*
 				/*
 				 * This race can happen because we've dropped
 				 * 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.
 				 * restart the search.
 				 */
 				 */
 				mutex_unlock(&victim->state_mutex);
 				mutex_unlock(&victim->state_mutex);