Commit b3e76cc3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Arnd Bergmann

[POWERPC] spu sched: ensure preempted threads are put back on the runqueue

To not lose a spu thread we need to make sure it always gets put back
on the runqueue.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
parent 43c2bbd9
...@@ -97,7 +97,7 @@ void spu_sched_tick(struct work_struct *work) ...@@ -97,7 +97,7 @@ void spu_sched_tick(struct work_struct *work)
struct spu_context *ctx = struct spu_context *ctx =
container_of(work, struct spu_context, sched_work.work); container_of(work, struct spu_context, sched_work.work);
struct spu *spu; struct spu *spu;
int rearm = 1; int preempted = 0;
/* /*
* If this context is being stopped avoid rescheduling from the * If this context is being stopped avoid rescheduling from the
...@@ -113,12 +113,19 @@ void spu_sched_tick(struct work_struct *work) ...@@ -113,12 +113,19 @@ void spu_sched_tick(struct work_struct *work)
int best = sched_find_first_bit(spu_prio->bitmap); int best = sched_find_first_bit(spu_prio->bitmap);
if (best <= ctx->prio) { if (best <= ctx->prio) {
spu_deactivate(ctx); spu_deactivate(ctx);
rearm = 0; preempted = 1;
} }
} }
mutex_unlock(&ctx->state_mutex); mutex_unlock(&ctx->state_mutex);
if (rearm) if (preempted) {
/*
* We need to break out of the wait loop in spu_run manually
* to ensure this context gets put on the runqueue again
* ASAP.
*/
wake_up(&ctx->stop_wq);
} else
spu_start_tick(ctx); spu_start_tick(ctx);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment