Skip to content

Commit

Permalink
[POWERPC] spufs: spu_find_victim may choose wrong victim
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luke Browning authored and Paul Mackerras committed Dec 21, 2007
1 parent 9156953 commit b192541
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/cell/spufs/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,10 @@ static struct spu *find_victim(struct spu_context *ctx)
}

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.
*/
mutex_unlock(&victim->state_mutex);
Expand Down

0 comments on commit b192541

Please sign in to comment.