Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60639
b: refs/heads/master
c: 2cf2b3b
h: refs/heads/master
i:
  60637: 731365b
  60635: ad2e95f
  60631: 9752c7d
  60623: 9d593fd
  60607: 7cde813
v: v3
  • Loading branch information
Christoph Hellwig authored and Paul Mackerras committed Jul 3, 2007
1 parent b3eca38 commit 60eb44c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 15 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: f3f59bec0c7ad083e9c95a550bcb1e9ca27e25f4
refs/heads/master: 2cf2b3b49f10d2f4a0703070fc54ce1cd84a6cda
11 changes: 0 additions & 11 deletions trunk/arch/powerpc/platforms/cell/spufs/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
if (gang)
spu_gang_add_ctx(gang, ctx);

/*
* We do our own priority calculations, so we normally want
* ->static_prio to start with. Unfortunately thies field
* contains junk for threads with a realtime scheduling
* policy so we have to look at ->prio in this case.
*/
if (rt_prio(current->prio))
ctx->prio = current->prio;
else
ctx->prio = current->static_prio;
ctx->policy = current->policy;
spu_set_timeslice(ctx);
goto out;
out_free:
Expand Down
19 changes: 16 additions & 3 deletions trunk/arch/powerpc/platforms/cell/spufs/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,22 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx,
ctx->ops->master_start(ctx);
ctx->event_return = 0;

ret = spu_acquire_runnable(ctx, 0);
if (ret)
return ret;
spu_acquire(ctx);
if (ctx->state == SPU_STATE_SAVED) {
__spu_update_sched_info(ctx);

ret = spu_activate(ctx, 0);
if (ret) {
spu_release(ctx);
goto out;
}
} else {
/*
* We have to update the scheduling priority under active_mutex
* to protect against find_victim().
*/
spu_update_sched_info(ctx);
}

ret = spu_run_init(ctx, npc);
if (ret) {
Expand Down
27 changes: 27 additions & 0 deletions trunk/arch/powerpc/platforms/cell/spufs/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,33 @@ void spu_set_timeslice(struct spu_context *ctx)
ctx->time_slice = SCALE_PRIO(DEF_SPU_TIMESLICE, ctx->prio);
}

/*
* Update scheduling information from the owning thread.
*/
void __spu_update_sched_info(struct spu_context *ctx)
{
/*
* We do our own priority calculations, so we normally want
* ->static_prio to start with. Unfortunately thies field
* contains junk for threads with a realtime scheduling
* policy so we have to look at ->prio in this case.
*/
if (rt_prio(current->prio))
ctx->prio = current->prio;
else
ctx->prio = current->static_prio;
ctx->policy = current->policy;
}

void spu_update_sched_info(struct spu_context *ctx)
{
int node = ctx->spu->node;

mutex_lock(&spu_prio->active_mutex[node]);
__spu_update_sched_info(ctx);
mutex_unlock(&spu_prio->active_mutex[node]);
}

static inline int node_allowed(int node)
{
cpumask_t mask;
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/platforms/cell/spufs/spufs.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ int spu_activate(struct spu_context *ctx, unsigned long flags);
void spu_deactivate(struct spu_context *ctx);
void spu_yield(struct spu_context *ctx);
void spu_set_timeslice(struct spu_context *ctx);
void spu_update_sched_info(struct spu_context *ctx);
void __spu_update_sched_info(struct spu_context *ctx);
int __init spu_sched_init(void);
void __exit spu_sched_exit(void);

Expand Down

0 comments on commit 60eb44c

Please sign in to comment.