]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/cell/spufs/context.c
[POWERPC] spusched: Update scheduling paramters on every spu_run
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / cell / spufs / context.c
index 8654749e317bae0aa67795dda4ba2eebdae50c3f..c778d9178e0f1fce1c7af60f9257d5034c31266a 100644 (file)
@@ -39,7 +39,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
        if (spu_init_csa(&ctx->csa))
                goto out_free;
        spin_lock_init(&ctx->mmio_lock);
-       spin_lock_init(&ctx->mapping_lock);
+       mutex_init(&ctx->mapping_lock);
        kref_init(&ctx->kref);
        mutex_init(&ctx->state_mutex);
        mutex_init(&ctx->run_mutex);
@@ -53,10 +53,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
        INIT_LIST_HEAD(&ctx->rq);
        if (gang)
                spu_gang_add_ctx(gang, ctx);
-       ctx->rt_priority = current->rt_priority;
-       ctx->policy = current->policy;
-       ctx->prio = current->prio;
-       INIT_DELAYED_WORK(&ctx->sched_work, spu_sched_tick);
+
+       spu_set_timeslice(ctx);
        goto out;
 out_free:
        kfree(ctx);
@@ -103,6 +101,7 @@ void spu_forget(struct spu_context *ctx)
 
 void spu_unmap_mappings(struct spu_context *ctx)
 {
+       mutex_lock(&ctx->mapping_lock);
        if (ctx->local_store)
                unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
        if (ctx->mfc)
@@ -117,6 +116,7 @@ void spu_unmap_mappings(struct spu_context *ctx)
                unmap_mapping_range(ctx->mss, 0, 0x1000, 1);
        if (ctx->psmap)
                unmap_mapping_range(ctx->psmap, 0, 0x20000, 1);
+       mutex_unlock(&ctx->mapping_lock);
 }
 
 /**