Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757949AbbFQRYk (ORCPT ); Wed, 17 Jun 2015 13:24:40 -0400 Received: from relay.parallels.com ([195.214.232.42]:56668 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757774AbbFQRY0 (ORCPT ); Wed, 17 Jun 2015 13:24:26 -0400 Message-ID: <1434561864.1711.51.camel@odin.com> Subject: Re: [PATCH] exit: Clarify choice of new parent in forget_original_parent() From: Kirill Tkhai To: Oleg Nesterov CC: , Andrew Morton Date: Wed, 17 Jun 2015 20:24:24 +0300 In-Reply-To: <20150616200352.GA30871@redhat.com> References: <1434448194.1711.1.camel@odin.com> <20150616192759.GA28955@redhat.com> <20150616200352.GA30871@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Originating-IP: [10.30.16.109] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1680 Lines: 45 В Вт, 16/06/2015 в 22:03 +0200, Oleg Nesterov пишет: > 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. Sure, it's more logical. Thanks, 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/