[Cbe-oss-dev] [RFC 2/5] spufs: add kalloc_spu_context()
Sebastian Siewior
bigeasy at linux.vnet.ibm.com
Wed Jun 13 17:05:19 EST 2007
Arnd Bergmann wrote:
> On Tuesday 12 June 2007, Sebastian Siewior wrote:
>> +struct spu_context *kalloc_spu_context(struct spu_gang *gang)
>> +{
>> + struct spu_context *ctx;
>> +
>> + ctx = __alloc_spu_context(gang);
>> + if (!ctx)
>> + return ctx;
>> +
>> + /* for priviliged spu context, we borrow all the task specific
>> + * informations from init.
>> + */
>> + ctx->owner = &init_mm;
>> + atomic_inc(&init_mm.mm_users);
>> +
>> + /* remove problem state bit, others are fine */
>> + ctx->csa.priv1.mfc_sr1_RW &= ~MFC_STATE1_PROBLEM_STATE_MASK;
>> + ctx->rt_priority = init_task.rt_priority;
>> + ctx->policy = init_task.policy;
>> + ctx->prio = init_task.prio;
>> +
>> + INIT_DELAYED_WORK(&ctx->sched_work, spu_sched_tick);
>> + return ctx;
>> +}
>
> I just noticed that this function is almost the same as your
> new alloc_spu_context() function. I think you should try to
> keep more of the code common, by passing the mm_struct and
> the task_struct down to the __alloc_spu_context()
> function.
Okey. This will work for prio but not for mm because init_task.mm is null.
> Arnd <><
Sebastian
More information about the cbe-oss-dev
mailing list