Re: + prctl-add-pr_setget_child_reaper-to-allow-simple-process-supervision.patch added to -mm tree

From: Kay Sievers
Date: Fri Aug 19 2011 - 08:45:13 EST


On Fri, Aug 19, 2011 at 14:25, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> On 08/19, Kay Sievers wrote:
>> + Â Â Â Â Â Â /* find the first ancestor marked as child_subreaper */
>> + Â Â Â Â Â Â for (reaper = father->real_parent;
>> + Â Â Â Â Â Â Â Â Âreaper != reaper->real_parent;
>
> This looks mysterious. This relies on the fact that INIT_TASK(tsk)
> sets .real_parent = tsk. "reaper != &init_task" looks much more clean.
>
> But. Now that you check ->has_child_subreaper before the lookup,
> this problem should go away? I mean, if ->has_child_subreaper == T
> then some of our parents is the userspace task. Even if it was
> spawned by kthread and then exited, we can't miss ->child_reaper
> in the parents chain.

That's right. We only ever look at 'flagged' processes now, and no
other than a userspace process can ever be tagged. We can just walk up
to ->child_reaper.

> Or I missed something?

I think that's right. I'll test it.

>> + Â Â Â Â Â Â case PR_SET_CHILD_SUBREAPER:
>> + Â Â Â Â Â Â Â Â Â Â me->signal->is_child_subreaper = !!arg2;
>> + Â Â Â Â Â Â Â Â Â Â me->signal->has_child_subreaper = true;
>
> Hmm. This looks wrong... why do we set ->has_child_subreaper?

That's the flag we pass down to our childs, hence we need to set it here.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/