diff options
| author | Jeremy Kerr <jk@ozlabs.org> | 2008-03-04 04:17:02 -0500 |
|---|---|---|
| committer | Jeremy Kerr <jk@ozlabs.org> | 2008-03-10 21:28:02 -0400 |
| commit | ce7c191bca88aa2f942f70a6d6c6315739a81a32 (patch) | |
| tree | 9acd862b1278fb4cc38f52ae11715e050e505621 | |
| parent | 3cecdda3f169f22f324f78fd544beee68e3cc6a4 (diff) | |
[POWERPC] spufs: don't (ab)use SCHED_IDLE
commit 4ef11014 introduced a usage of SCHED_IDLE to detect when
a context is within spu_run.
Instead of SCHED_IDLE (which has other meaning), add a flag to
sched_flags to tell if a context should be running.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
| -rw-r--r-- | arch/powerpc/platforms/cell/spufs/run.c | 3 | ||||
| -rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 4 | ||||
| -rw-r--r-- | arch/powerpc/platforms/cell/spufs/spufs.h | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index 6221968c2a3c..cac69e116776 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c | |||
| @@ -220,6 +220,7 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc) | |||
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | set_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags); | ||
| 223 | return 0; | 224 | return 0; |
| 224 | } | 225 | } |
| 225 | 226 | ||
| @@ -234,7 +235,7 @@ static int spu_run_fini(struct spu_context *ctx, u32 *npc, | |||
| 234 | *npc = ctx->ops->npc_read(ctx); | 235 | *npc = ctx->ops->npc_read(ctx); |
| 235 | 236 | ||
| 236 | spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED); | 237 | spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED); |
| 237 | ctx->policy = SCHED_IDLE; | 238 | clear_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags); |
| 238 | spu_release(ctx); | 239 | spu_release(ctx); |
| 239 | 240 | ||
| 240 | if (signal_pending(current)) | 241 | if (signal_pending(current)) |
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 5d5f680cd0b8..00528ef84ad2 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
| @@ -867,7 +867,7 @@ static noinline void spusched_tick(struct spu_context *ctx) | |||
| 867 | if (ctx->policy == SCHED_FIFO) | 867 | if (ctx->policy == SCHED_FIFO) |
| 868 | goto out; | 868 | goto out; |
| 869 | 869 | ||
| 870 | if (--ctx->time_slice && ctx->policy != SCHED_IDLE) | 870 | if (--ctx->time_slice && test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) |
| 871 | goto out; | 871 | goto out; |
| 872 | 872 | ||
| 873 | spu = ctx->spu; | 873 | spu = ctx->spu; |
| @@ -877,7 +877,7 @@ static noinline void spusched_tick(struct spu_context *ctx) | |||
| 877 | new = grab_runnable_context(ctx->prio + 1, spu->node); | 877 | new = grab_runnable_context(ctx->prio + 1, spu->node); |
| 878 | if (new) { | 878 | if (new) { |
| 879 | spu_unschedule(spu, ctx); | 879 | spu_unschedule(spu, ctx); |
| 880 | if (ctx->policy != SCHED_IDLE) | 880 | if (test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) |
| 881 | spu_add_to_rq(ctx); | 881 | spu_add_to_rq(ctx); |
| 882 | } else { | 882 | } else { |
| 883 | spu_context_nospu_trace(spusched_tick__newslice, ctx); | 883 | spu_context_nospu_trace(spusched_tick__newslice, ctx); |
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index 2c2fe3c07d72..cdc515182f82 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h | |||
| @@ -44,6 +44,7 @@ struct spu_gang; | |||
| 44 | enum { | 44 | enum { |
| 45 | SPU_SCHED_NOTIFY_ACTIVE, | 45 | SPU_SCHED_NOTIFY_ACTIVE, |
| 46 | SPU_SCHED_WAS_ACTIVE, /* was active upon spu_acquire_saved() */ | 46 | SPU_SCHED_WAS_ACTIVE, /* was active upon spu_acquire_saved() */ |
| 47 | SPU_SCHED_SPU_RUN, /* context is within spu_run */ | ||
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | struct spu_context { | 50 | struct spu_context { |
