Thread (5 messages) flat view 5 messages, 5 authors, 2015-03-20

Re: [PATCH v2 5/7] clone4: Add a CLONE_AUTOREAP flag to automatically reap the child process

From: Josh Triplett <hidden>
Date: 2015-03-15 23:34:40
Also in: linux-fsdevel, lkml

On Sun, Mar 15, 2015 at 08:55:06PM +0100, Oleg Nesterov wrote:
On 03/15, Josh Triplett wrote:
quoted
On Sun, Mar 15, 2015 at 03:52:23PM +0100, Oleg Nesterov wrote:
quoted
On 03/15, Josh Triplett wrote:
quoted
Add a CLONE_AUTOREAP flag to request this behavior unconditionally,
Yes, CLONE_AUTOREAP is much better. And I agree (mostly) with that
we should rely on do_notify_parent().

Howver the patch still doesn't look right. First of all, ->autoreap
should be per-process, not per-thread.
Ah, you're thinking of the case where the parent process launches a
...
Not really, although we probably need more sanity checks.

It should be per-process simply because this "autoreap" affects the whole
process. And the sub-threads are already "autoreap". And these 2 autoreap's
semantics differ, we should not confuse them.
Will the approach I suggested, of having clones with CLONE_THREAD
inherit the autoreap value rather than setting it from CLONE_AUTOREAP,
implement the semantics you're looking for?

Also, are you suggesting that CLONE_AUTOREAP with CLONE_THREAD should
produce -EINVAL, or just that it should be ignored?
quoted
(As an aside, what *is* the use case for CLONE_PARENT without
CLONE_THREAD?)
To me CLONE_PARENT is another historical mistake and the source of misc
problems ;)
I kinda figured. :)
quoted
quoted
And there are ptrace/mt issues,
it seems. Just for example, we should avoid EXIT_TRACE if autoreap in
wait_task_zombie() even if we are going to re-notify parent.
I don't see how EXIT_TRACE can happen in wait_task_zombie if autoreap is
set.  wait_task_zombie does a cmpxchg with exit_state and doesn't
proceed unless exit_state was EXIT_ZOMBIE, and I don't see how we can
ever reach the EXIT_ZOMBIE state if autoreap.
Because you again forgot about ptrace ;)

Josh. Let me try to summarise this later when I have time. Again, I am
not sure, perhaps this is even simpler than I currently think. And let
me apologize in advance, most probably I will be busy tomorrow.
I look forward to your later review and feedback.

- Josh Triplett
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help