@@ -51,7 +51,7 @@
struct spu_prio_array {
DECLARE_BITMAP(bitmap, MAX_PRIO);
struct list_head runq[MAX_PRIO];
- spinlock_t runq_lock;
+ struct mutex runq_lock;
int nr_waiting;
};
@@ -179,9 +179,9 @@ static int node_allowed(struct spu_context *ctx, int node)
{
int rval;
- spin_lock(&spu_prio->runq_lock);
+ mutex_lock(&spu_prio->runq_lock);
rval = __node_allowed(ctx, node);
- spin_unlock(&spu_prio->runq_lock);
+ mutex_unlock(&spu_prio->runq_lock);
return rval;
}
@@ -514,9 +514,9 @@ static void __spu_add_to_rq(struct spu_context *ctx)
static void spu_add_to_rq(struct spu_context *ctx)
{
- spin_lock(&spu_prio->runq_lock);
+ mutex_lock(&spu_prio->runq_lock);
__spu_add_to_rq(ctx);
- spin_unlock(&spu_prio->runq_lock);
+ mutex_unlock(&spu_prio->runq_lock);
}
static void __spu_del_from_rq(struct spu_context *ctx)
@@ -535,9 +535,9 @@ static void __spu_del_from_rq(struct spu_context *ctx)
void spu_del_from_rq(struct spu_context *ctx)
{
- spin_lock(&spu_prio->runq_lock);
+ mutex_lock(&spu_prio->runq_lock);
__spu_del_from_rq(ctx);
- spin_unlock(&spu_prio->runq_lock);
+ mutex_unlock(&spu_prio->runq_lock);
}
static void spu_prio_wait(struct spu_context *ctx)
@@ -551,18 +551,18 @@ static void spu_prio_wait(struct spu_context *ctx)
*/
BUG_ON(!(ctx->flags & SPU_CREATE_NOSCHED));
- spin_lock(&spu_prio->runq_lock);
+ mutex_lock(&spu_prio->runq_lock);
prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE);
if (!signal_pending(current)) {
__spu_add_to_rq(ctx);
- spin_unlock(&spu_prio->runq_lock);
+ mutex_unlock(&spu_prio->runq_lock);
mutex_unlock(&ctx->state_mutex);
schedule();
mutex_lock(&ctx->state_mutex);
- spin_lock(&spu_prio->runq_lock);
+ mutex_lock(&spu_prio->runq_lock);
__spu_del_from_rq(ctx);
}
- spin_unlock(&spu_prio->runq_lock);
+ mutex_unlock(&spu_prio->runq_lock);
__set_current_state(TASK_RUNNING);
remove_wait_queue(&ctx->stop_wq, &wait);
}
@@ -838,7 +838,7 @@ static struct spu_context *grab_runnable_context(int prio, int node)
struct spu_context *ctx;
int best;
- spin_lock(&spu_prio->runq_lock);
+ mutex_lock(&spu_prio->runq_lock);
best = find_first_bit(spu_prio->bitmap, prio);
while (best < prio) {
struct list_head *rq = &spu_prio->runq[best];
@@ -854,7 +854,7 @@ static struct spu_context *grab_runnable_context(int prio, int node)
}
ctx = NULL;
found:
- spin_unlock(&spu_prio->runq_lock);
+ mutex_unlock(&spu_prio->runq_lock);
return ctx;
}
@@ -1122,7 +1122,7 @@ int __init spu_sched_init(void)
INIT_LIST_HEAD(&spu_prio->runq[i]);
__clear_bit(i, spu_prio->bitmap);
}
- spin_lock_init(&spu_prio->runq_lock);
+ mutex_init(&spu_prio->runq_lock);
setup_timer(&spusched_timer, spusched_wake, 0);
setup_timer(&spuloadavg_timer, spuloadavg_wake, 0);