Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1166353

Re: [PATCH] exit: Clarify choice of new parent in forget_original_parent()

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] exit: Clarify choice of new parent in forget_original_parent()
Date Tue, 16 Jun 2015 22:10:01 +0200
Message-ID <pC5lf-4rn-3@gated-at.bofh.it> (permalink)
References <pBVOW-7df-9@gated-at.bofh.it> <pC4Iy-3oZ-11@gated-at.bofh.it>
X-Original-To Kirill Tkhai <ktkhai@odin.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.18 (2008-05-17)
X-Scanned-By MIMEDefang 2.68 on 10.5.11.26
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 44
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
X-Original-Date Tue, 16 Jun 2015 22:03:52 +0200
X-Original-Message-ID <20150616200352.GA30871@redhat.com>
X-Original-References <1434448194.1711.1.camel@odin.com> <20150616192759.GA28955@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1166353

Show key headers only | View raw


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.

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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCH] exit: Clarify choice of new parent in  forget_original_parent() Oleg Nesterov <oleg@redhat.com> - 2015-06-16 21:30 +0200
  Re: [PATCH] exit: Clarify choice of new parent in  forget_original_parent() Oleg Nesterov <oleg@redhat.com> - 2015-06-16 22:10 +0200

csiph-web