Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp492784rdb; Thu, 30 Nov 2023 09:57:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLIo+My+ugO9s1wmgnqB8o/XtkwDvZlKZwbkwe/PxQ1NT2DmS6Ex1vyWIfPNtFQgHSY7JJ X-Received: by 2002:a05:6a00:8e0b:b0:6cd:e600:8d05 with SMTP id io11-20020a056a008e0b00b006cde6008d05mr2834870pfb.29.1701367041319; Thu, 30 Nov 2023 09:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701367041; cv=none; d=google.com; s=arc-20160816; b=i2TJFXmC3R/3N5ZlPK85sFpBQoTiUIQPA2F/4jAg3GhW9twvieCrGrheJbYTfyKjPM 0toCGytoX9gEu4mg1/ldORtUyn4+NP1Ixf45HMAVwCCLZeaPPm7kUfD1l+HYz3TRc3+4 hIngHacFwzDrxejTu68NTLpsmJMVH9/xmPe9/Dc7uBjaMC3gDn6TPEwRAbpf5FdOchMd tRUaajof5QXOfhSvMuhn9WS8jc2rSqlcSies56W3WkC5Ihib846BDSlWxK+zEYEehb1b P7V5tTRDKkRfmDD66fWbZqVX0u1Ug95OtQBxHTQ6AfzaF9FzLhI5jqkAc4dApWRcSBLv /D2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=5DinRe2Ja+E6Yl6fvgP5dTyogaDC1dFejinC1nN/SsY=; fh=ZvX2+2EYGrPDPrHIb4xscRuTqbfN9kJDE/+1r7/4tlY=; b=xcpknQbIByvKTrf0dIkfiKhJ4HucnjYadtVVbckvJl93ltPKLsd3psK++AzX2B3d8J T1xjR13gemM2tO4rS9MBQRCA+XXYaxSwZEJg15Z10ID31H8W0gBdWeKvh7mTSqqdqpSE 4HQL0iK2MtbN+IBDTjwMaRBmZ97muDdfeCZq59vHb9ZXbU218LVnfU67NdVw6JxQ87HH 0JBZBQD5JcLYixO3ql50TTAOmUzh040z00SDkyRah1L8tEJAljz8LHZLjaepkYoGUodj sfrWQnMarClXoYdg4y4xInju7vqx1vwR9Aodozy/dGlaZ5Kplpa7Ne+4xMn5KgM1h04F nIDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm3 header.b=oEZgAwZ9; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=yBO7hsXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b19-20020a6567d3000000b005c1739564f7si1727431pgs.351.2023.11.30.09.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 09:57:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm3 header.b=oEZgAwZ9; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=yBO7hsXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E33CE801F231; Thu, 30 Nov 2023 09:57:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbjK3R5D (ORCPT + 99 others); Thu, 30 Nov 2023 12:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235239AbjK3R5A (ORCPT ); Thu, 30 Nov 2023 12:57:00 -0500 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFC6510F4; Thu, 30 Nov 2023 09:57:04 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8798A5C02E6; Thu, 30 Nov 2023 12:57:01 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 30 Nov 2023 12:57:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1701367021; x=1701453421; bh=5D inRe2Ja+E6Yl6fvgP5dTyogaDC1dFejinC1nN/SsY=; b=oEZgAwZ9WRw0EqIhAP uyMMCuO/T84vdiNjP6/l9KP8gUO9upcLSlIYc3E6VEhUh2NmIewXXmYR3GIsZy8T TWJYrn4iACpf2SwJWAYx8mDdvEXrChVpsb9XpJtBmw29i0z7vvZWNe7O13zoEYOD GGUEmr1zMICpv/Y+BR70OCnTEFGVrjQi8NfZ4JbIf9be6MWU3zwSEshzIYkiAYQV m8Oq3P7wSNgt3e4+GAqxJ3vC3RTiWXYDfcpyxhUQrH7Rd12JYwVwFqbOHdoKlqmz aW0CuI/iqTJrmYQio9aX7K6KWmNCDptb1o2MotlH7sNtrDQzJKv6v+Meg8wA7FaG 1y9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701367021; x=1701453421; bh=5DinRe2Ja+E6Y l6fvgP5dTyogaDC1dFejinC1nN/SsY=; b=yBO7hsXuBEm3JxgYZ5HPuNJ/xO4J5 9dqkV1sJtmbgeMtYafJ3A057AM819bf7N2TEfTE1fnr3FlKU7dSv76m7tZHsJ2nF QpbJ2YvTinQHEkslg1fDD3MX1iC5lrcqyLgKkkXktoPKlTMCbbNgrziOj4Z06u9h sSFhj9981nDzmLXH7mfPS9762YArlkQcfnqtvWMnGwxVGAXLrSw0nKEhpN7psHqA HUCsiwDwlsOFI8hzelbzKrlKmh7hNYLH6x/3pRzXMjviax/b7590IEPr+bz7Yz8v WPUNlqZgnkw7vyNcXVluubv/rwKgW2MPBUhs8DqnaGxOoykV5Khc+7cWA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeijedguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefvhigt hhhoucetnhguvghrshgvnhcuoehthigthhhosehthigthhhordhpihiiiigrqeenucggtf frrghtthgvrhhnpeeutedttefgjeefffehffffkeejueevieefudelgeejuddtfeffteek lefhleelteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthigthhhosehthigthhhordhpihiiiigr X-ME-Proxy: Feedback-ID: i21f147d5:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Nov 2023 12:56:59 -0500 (EST) Date: Thu, 30 Nov 2023 10:56:58 -0700 From: Tycho Andersen To: Oleg Nesterov Cc: Christian Brauner , "Eric W . Biederman" , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Tycho Andersen Subject: Re: [RFC 1/3] pidfd: allow pidfd_open() on non-thread-group leaders Message-ID: References: <20231130163946.277502-1-tycho@tycho.pizza> <20231130173938.GA21808@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130173938.GA21808@redhat.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 30 Nov 2023 09:57:19 -0800 (PST) On Thu, Nov 30, 2023 at 06:39:39PM +0100, Oleg Nesterov wrote: > Hi Tycho, > > I can't really read this patch now, possibly I am wrong, but... No worries, no rush here. > On 11/30, Tycho Andersen wrote: > > > > @@ -263,16 +263,25 @@ void release_task(struct task_struct *p) > > */ > > zap_leader = 0; > > leader = p->group_leader; > > - if (leader != p && thread_group_empty(leader) > > - && leader->exit_state == EXIT_ZOMBIE) { > > - /* > > - * If we were the last child thread and the leader has > > - * exited already, and the leader's parent ignores SIGCHLD, > > - * then we are the one who should release the leader. > > - */ > > - zap_leader = do_notify_parent(leader, leader->exit_signal); > > - if (zap_leader) > > - leader->exit_state = EXIT_DEAD; > > + if (leader != p) { > > + if (thread_group_empty(leader) > > + && leader->exit_state == EXIT_ZOMBIE) { > > + /* > > + * If we were the last child thread and the leader has > > + * exited already, and the leader's parent ignores SIGCHLD, > > + * then we are the one who should release the leader. > > + */ > > + zap_leader = do_notify_parent(leader, > > + leader->exit_signal); > > + if (zap_leader) > > + leader->exit_state = EXIT_DEAD; > > + } else { > > + /* > > + * wake up pidfd pollers anyway, they want to know this > > + * thread is dying. > > + */ > > + wake_up_all(&thread_pid->wait_pidfd); > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > somehow I can't believe this is a good change after a quick glance ;) Yeah, I figured it would raise some eyebrows :) > I think that wake_up_all(wait_pidfd) should have a single caller, > do_notify_pidfd(). This probably means it should be shiftef from > do_notify_parent() to exit_notify(), I am not sure... __exit_signals() is what I was thinking in the patch description, but I'll look at exit_notify() too. Tycho