[PATCH] Use struct pid parameter in copy_process()

Eric W. Biederman ebiederm at xmission.com
Fri Feb 23 19:29:02 PST 2007


sukadev at us.ibm.com writes:

> Yes. I can break that up into two patches, but I missed and Badari
> pointed the other caller to copy_process()
>
> struct task_struct * __cpuinit fork_idle(int cpu)
> {
>         struct task_struct *task;
>         struct pt_regs regs;
>
>         task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL, 0);
>         if (!IS_ERR(task))
>                 init_idle(task, cpu);
>
>         return task;
> }
>
> Now this is passing a null struct pid which would not be good 
> if I remove the if (likely(p->pid)) check in copy_process().
>
> Does this copy_process() mean there can be multiple tasks with
> pid_t == 0 (one per cpu on an SMP system) ?

Yes.  The idle processes.

> Can we simply attach all those tasks to init_struct_pid by passing
> in &init_struct_pid to the above copy_process() ?

Yes.

Eric



More information about the Containers mailing list