]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/cell/spufs/context.c
[POWERPC] spufs: add context switch notification log
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / cell / spufs / context.c
index 133995ed5cc78c104745534915ec3331f6601ed6..91f2d4d9aefd71eb2ab08cf113857f4c424dace2 100644 (file)
@@ -88,6 +88,7 @@ void destroy_spu_context(struct kref *kref)
                kref_put(ctx->prof_priv_kref, ctx->prof_priv_release);
        BUG_ON(!list_empty(&ctx->rq));
        atomic_dec(&nr_spu_contexts);
+       kfree(ctx->switch_log);
        kfree(ctx);
 }
 
@@ -109,13 +110,12 @@ void spu_forget(struct spu_context *ctx)
 
        /*
         * This is basically an open-coded spu_acquire_saved, except that
-        * we don't acquire the state mutex interruptible.
+        * we don't acquire the state mutex interruptible, and we don't
+        * want this context to be rescheduled on release.
         */
        mutex_lock(&ctx->state_mutex);
-       if (ctx->state != SPU_STATE_SAVED) {
-               set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags);
+       if (ctx->state != SPU_STATE_SAVED)
                spu_deactivate(ctx);
-       }
 
        mm = ctx->owner;
        ctx->owner = NULL;
@@ -171,7 +171,8 @@ void spu_release_saved(struct spu_context *ctx)
 {
        BUG_ON(ctx->state != SPU_STATE_SAVED);
 
-       if (test_and_clear_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags))
+       if (test_and_clear_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags) &&
+                       test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags))
                spu_activate(ctx, 0);
 
        spu_release(ctx);