public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Kirill Tkhai <ktkhai@odin.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] exit: Clarify choice of new parent in forget_original_parent()
Date: Tue, 16 Jun 2015 22:03:52 +0200	[thread overview]
Message-ID: <20150616200352.GA30871@redhat.com> (raw)
In-Reply-To: <20150616192759.GA28955@redhat.com>

forgot to mention,

On 06/16, Oleg Nesterov wrote:
>
> On 06/16, Kirill Tkhai wrote:
> >
> > +	 * child_reaper doesn't have children after zap_pid_ns_processes(),
> > +	 * therefore it can't enter this function.
> > +	 */
> > +	BUG_ON(child_reaper == father);
>
> Yes, we can add this BUG_ON(). But please see the comments in
> zap_pid_ns_processes(). We can change zap_pid_ns_processes() so that
> it returns with non-empty ->children list due to EXIT_DEAD children.
>
> Unlikely we will actually do this, at least soon, so I won't argue
> with this BUG_ON().
>
> But. In this case it would be better to add it into forget_original_parent(),
>
> 	reaper = find_new_reaper(...);
> 	BUG_ON(reaper == father);

because this way:

	1. This BUG_ON() will still be valid even if we actually change
	   zap_pid_ns_processes() to return with EXIT_DEAD children

	2. If we really want this sanity check, we should not tie it to
	   ->child_reaper case.

OTOH. If for some reason you want to check ->child_reaper only, then
you should probably do this right after list_empty(&father->children)
check, or at least before find_alive_thread(). Because otherwise it
looks confusing, it looks as if "child_reaper == father" is only wrong
if find_alive_thread(father) fails.

Oleg.


  reply	other threads:[~2015-06-16 20:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16  9:49 [PATCH] exit: Clarify choice of new parent in forget_original_parent() Kirill Tkhai
2015-06-16 19:27 ` Oleg Nesterov
2015-06-16 20:03   ` Oleg Nesterov [this message]
2015-06-17 17:24     ` Kirill Tkhai
2015-06-17 17:23   ` Kirill Tkhai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150616200352.GA30871@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ktkhai@odin.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox