From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932187AbdA3OM0 (ORCPT ); Mon, 30 Jan 2017 09:12:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52296 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753557AbdA3OMQ (ORCPT ); Mon, 30 Jan 2017 09:12:16 -0500 Date: Mon, 30 Jan 2017 15:01:15 +0100 From: Oleg Nesterov To: Pavel Tikhomirov Cc: Ingo Molnar , Peter Zijlstra , Andrew Morton , Cyrill Gorcunov , John Stultz , Thomas Gleixner , Nicolas Pitre , Michal Hocko , Stanislav Kinsburskiy , Mateusz Guzik , linux-kernel@vger.kernel.org, Pavel Emelyanov , Konstantin Khorenko , Lennart Poettering , "Eric W . Biederman" , Kay Sievers Subject: Re: [PATCH v2 2/2] prctl: propagate has_child_subreaper flag to every descendant Message-ID: <20170130140114.GB24718@redhat.com> References: <20170127100543.18390-1-ptikhomirov@virtuozzo.com> <20170127100543.18390-3-ptikhomirov@virtuozzo.com> <20170130125141.GA22583@redhat.com> <0eb16bca-eb0d-edd1-de6a-524f155b492b@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0eb16bca-eb0d-edd1-de6a-524f155b492b@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 30 Jan 2017 14:01:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/30, Pavel Tikhomirov wrote: > > On 01/30/2017 03:51 PM, Oleg Nesterov wrote: > >>+ /* > >>+ * Inherit has_child_subreaper flag under the same > >>+ * tasklist_lock with adding child to the process tree > >>+ * for propagate_has_child_subreaper optimization. > >>+ */ > >>+ p->signal->has_child_subreaper = current->signal->has_child_subreaper || > >>+ current->signal->is_child_subreaper; > > > >Ah yes, we need this change too... > > > >And perhaps it would be more correct to do > > > > p->signal->has_child_subreaper = > > p->real_parent->signal->has_child_subreaper || > > p->real_parent->signal->is_child_subreaper; > > > >the current code is not exactly right if CLONE_PARENT... > > I'm fine with inheriting 'has' flag from real_parent, because if real_parent > does not have 'has' flag set but parent has 'has' set, we inherited the flag > in vain. > > But I don't actually think that inheritance from parent not real_parent > breaks my optimization: if real_parent has the flag, so does the parent. Not sure I understand... I meant, the usage of p->real_parent instead of "current" _looks_ more correct and clear, imo. Say, a is_child_subreaper task does clone(CLONE_PARENT), in this case (with or without your change) we set p->signal->has_child_subreaper = 1 and this is not really correct even if we do not really care. Oleg.