From eb5eda3ea38543921369a3a38e6dcd6f2b855b2f Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 14 Aug 2008 14:59:12 +1000 Subject: [PATCH] --- yaml --- r: 108903 b: refs/heads/master c: 8d5636fbca202f61fdb808fc9e20c0142291d802 h: refs/heads/master i: 108901: f27c817cef9e54f5d4cf8d6bc307e090dcc7b70d 108899: 224f70fde6180513cce8fcd82b965760b38ec3c4 108895: e31bf0bcd5baa9cc8a66388fbd90d608700e2302 v: v3 --- [refs] | 2 +- trunk/arch/powerpc/platforms/cell/spufs/sched.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 625d63c6afde..93f6001e1808 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d9dd421fd6ed17af55d27c8d93a9f561be0ff50f +refs/heads/master: 8d5636fbca202f61fdb808fc9e20c0142291d802 diff --git a/trunk/arch/powerpc/platforms/cell/spufs/sched.c b/trunk/arch/powerpc/platforms/cell/spufs/sched.c index 2deeeba7eccf..4b6b0c3a8c95 100644 --- a/trunk/arch/powerpc/platforms/cell/spufs/sched.c +++ b/trunk/arch/powerpc/platforms/cell/spufs/sched.c @@ -641,8 +641,10 @@ static struct spu *find_victim(struct spu_context *ctx) if (tmp && tmp->prio > ctx->prio && !(tmp->flags & SPU_CREATE_NOSCHED) && - (!victim || tmp->prio > victim->prio)) + (!victim || tmp->prio > victim->prio)) { victim = spu->ctx; + get_spu_context(victim); + } } mutex_unlock(&cbe_spu_info[node].list_mutex); @@ -658,6 +660,7 @@ static struct spu *find_victim(struct spu_context *ctx) * look at another context or give up after X retries. */ if (!mutex_trylock(&victim->state_mutex)) { + put_spu_context(victim); victim = NULL; goto restart; } @@ -670,6 +673,7 @@ static struct spu *find_victim(struct spu_context *ctx) * restart the search. */ mutex_unlock(&victim->state_mutex); + put_spu_context(victim); victim = NULL; goto restart; } @@ -687,6 +691,7 @@ static struct spu *find_victim(struct spu_context *ctx) spu_add_to_rq(victim); mutex_unlock(&victim->state_mutex); + put_spu_context(victim); return spu; } @@ -985,9 +990,11 @@ static int spusched_thread(void *unused) struct spu_context *ctx = spu->ctx; if (ctx) { + get_spu_context(ctx); mutex_unlock(mtx); spusched_tick(ctx); mutex_lock(mtx); + put_spu_context(ctx); } } mutex_unlock(mtx);