Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60650
b: refs/heads/master
c: 2744997
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Paul Mackerras committed Jul 3, 2007
1 parent 9d03370 commit 2bf9ff2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c77239b8be74f775142d9dd01041e2ce864ba20d
refs/heads/master: 27449971e6907ff38bde7bbc4647e55bd7309fc3
37 changes: 28 additions & 9 deletions trunk/arch/powerpc/platforms/cell/spufs/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,25 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
*/
static void __spu_add_to_rq(struct spu_context *ctx)
{
int prio = ctx->prio;

list_add_tail(&ctx->rq, &spu_prio->runq[prio]);
set_bit(prio, spu_prio->bitmap);
if (!spu_prio->nr_waiting++)
__mod_timer(&spusched_timer, jiffies + SPUSCHED_TICK);
/*
* Unfortunately this code path can be called from multiple threads
* on behalf of a single context due to the way the problem state
* mmap support works.
*
* Fortunately we need to wake up all these threads at the same time
* and can simply skip the runqueue addition for every but the first
* thread getting into this codepath.
*
* It's still quite hacky, and long-term we should proxy all other
* threads through the owner thread so that spu_run is in control
* of all the scheduling activity for a given context.
*/
if (list_empty(&ctx->rq)) {
list_add_tail(&ctx->rq, &spu_prio->runq[ctx->prio]);
set_bit(ctx->prio, spu_prio->bitmap);
if (!spu_prio->nr_waiting++)
__mod_timer(&spusched_timer, jiffies + SPUSCHED_TICK);
}
}

static void __spu_del_from_rq(struct spu_context *ctx)
Expand Down Expand Up @@ -440,12 +453,18 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
{
spuctx_switch_state(ctx, SPUCTX_UTIL_SYSTEM);

if (ctx->spu)
return 0;

do {
struct spu *spu;

/*
* If there are multiple threads waiting for a single context
* only one actually binds the context while the others will
* only be able to acquire the state_mutex once the context
* already is in runnable state.
*/
if (ctx->spu)
return 0;

spu = spu_get_idle(ctx);
/*
* If this is a realtime thread we try to get it running by
Expand Down

0 comments on commit 2bf9ff2

Please sign in to comment.