On 08/19, Kay Sievers wrote: > > On Fri, Aug 19, 2011 at 14:25, Oleg Nesterov <oleg@xxxxxxxxxx> wrote: > > >> + 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. Aha, I see. I've misread copy_signal(), it copies ->has_child_subreaper, _not_ ->is_child_subreaper (as I wrongly thought) from parent. And I was going to blame this logic in the next email, I already started to write it ;) But this has other (OK, minor) problems too, afaics. First of all, this ->has_child_subreaper = T is not right when the caller exits. We should not look for ->is_child_subreaper parent, our children should to find us. Right? And. afaics this makes the semantics of prctl(REAPER) a bit unclear... Suppose a task P does C1 = fork(); prctl(REAPER); C2 = fork(); In this case it "owns" the children of C2, but not C1. This is fine, and perhaps this is even better. But what if P->parent did prctl(REAPER) too? Then P becomes the sub-reaper for the tasks which were forked before prctl(). In short, in general the caller of prctl(REAPER) doesn't know how this can affect the forks in the past. Again, again, I am not arguing. Just I think we should discuss everything if we are going to add the new feature. Finally. I am not sure this is really better, but it seems we can can ->has_child_subreape "more correct" with the same effect. - prctl(PR_SET_CHILD_SUBREAPER): me->is_child_subreaper = !!arg2; // ->has_child_subreaper is not set - copy_signal(): me->has_child_subreaper = parent->has_child_subreaper || parent->is_child_subreaper; Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html