Re: [path][rfc] add PR_DETACH prctl command

From: Stas Sergeev
Date: Tue Apr 05 2011 - 12:25:20 EST


05.04.2011 19:15, Oleg Nesterov wrote:
I don't understand the "and not is a child on init's subthread".
If the child was created by init's sub-thread, it is the child
of the whole thread group.

->real_parent points to thread, yes.
OK, sorry, I thought you mean the CLONE_PARENT case, where
the real_parent points _not_ to thread. That's why the confusion.

But the parent is the whole
process, not thread. The only reason for this oddity is __WNOTHREAD.
OK, now I see what problem you are pointing to.
Will fix.

How? I think I prevented that with this:
---

+ p->detaching = 0;
+ continue;
Yes, thanks, I didn't notice "continue". But then this is wrong again.
This can race with wait_task_detached() called by our sub-thread, it
can clear ->detaching before we check it.
But the above code is under write_lock_irq(&tasklist_lock), so why
would it race?
--
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/