Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp483824rdb; Thu, 30 Nov 2023 09:41:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuzdNZHUIDa08RQemCxoIGrKRcqK+2PTCRPcIjHRbNf79et2eDzdcEUHawVyPz8PeV6ynJ X-Received: by 2002:a05:6a20:e30b:b0:18a:e003:21b6 with SMTP id nb11-20020a056a20e30b00b0018ae00321b6mr23056305pzb.61.1701366076664; Thu, 30 Nov 2023 09:41:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701366076; cv=none; d=google.com; s=arc-20160816; b=jHFxGKZP3WZaG4pHZIAqYALZ5Y/KW+okDcB3s5b/Zc4pLurq3+LVJKyz5sfYYmwxfp VBGUR8hZg1osWaJbuRWU9IgWHh1/9HjIArJxfoMiRo5J8pK1yEJWQOG96hKB+/AFvZ7E YX4DBJ3uehcehK/jqF0f7GzM3qpVY2rryuWlBtf6VqByQLRo3KPWxFgMh5VIZBDA9Eeh 8gAj8EPyd2cmlQ39FebHGBGQQLUvNLa6s2CGmjolF8mBYByluTpd9vDoeZhyXhoWoe6B WsvKl0y5/wfRt3kJHGanftdMlCkjAZ6UpaQU+SfXpoavPp9uvfq91+bqUk2tkJf3zc2R D2Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6Foztye0H5OMwSOdTOC/HcbTeXr+DTPVH4rsYB2c+xo=; fh=eOehLYGw4RcIQQ97gW2x6s9TBfbPdnBrAyUHfr+Pth4=; b=OtfhV/VkCHBeTS214gabUYjAhP7k1NQu0jrLpwW2Gx7jLgv5AV69/8cT0XdRw1ERfp OXm/1Qx3b+/dOdZcvL+N4nOM36wnE9DfAmoFlV68RgtXIZa1W0wIb9Y89S3Jkqh6Lotr WIj3tIq4VvwUqhNWw/FOXCJzrK1EAXR1//L1f+3RjAsf64QBtTgE9wAMXapRxp+dhjR8 fbQoqDr89WPPBTsALPSr9tNVHGiXsPZCbr4K9CR4PY78XH4TbMMUPKer1OT2Gc2tFikC q+AaDKjO9XYf70EzBSVGcohwvto59qlv6X15CLcBLXHHqSrrAfoiBCDoZsRadyAXgEFZ mPiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J7jo1Dfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y16-20020a656c10000000b005c24fb6927csi1905512pgu.656.2023.11.30.09.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 09:41:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J7jo1Dfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 665728021393; Thu, 30 Nov 2023 09:41:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346574AbjK3Rkw (ORCPT + 99 others); Thu, 30 Nov 2023 12:40:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbjK3Rkq (ORCPT ); Thu, 30 Nov 2023 12:40:46 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F107C131 for ; Thu, 30 Nov 2023 09:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701366052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6Foztye0H5OMwSOdTOC/HcbTeXr+DTPVH4rsYB2c+xo=; b=J7jo1DfsmKx1iMzK7xITdFwZa29FkmeCxZJu00FsAhnWkGURIGICv/nuLEC9hFSBPCziXp 3TEZxT6NqA1PgeqclDpEld9xbpxPyxaeikDwzEVCUunDec9DAYdK5lTX5O9PoPq49usesB 87arOSmeH/WsaHlhGEcTjsDmDwcp2fg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-INjEAH18OGWI7NXMeaPLkw-1; Thu, 30 Nov 2023 12:40:48 -0500 X-MC-Unique: INjEAH18OGWI7NXMeaPLkw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99FC73814E99; Thu, 30 Nov 2023 17:40:47 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.2]) by smtp.corp.redhat.com (Postfix) with SMTP id 0373840C6EBA; Thu, 30 Nov 2023 17:40:45 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 30 Nov 2023 18:39:41 +0100 (CET) Date: Thu, 30 Nov 2023 18:39:39 +0100 From: Oleg Nesterov To: Tycho Andersen 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: <20231130173938.GA21808@redhat.com> References: <20231130163946.277502-1-tycho@tycho.pizza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130163946.277502-1-tycho@tycho.pizza> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 09:41:13 -0800 (PST) Hi Tycho, I can't really read this patch now, possibly I am wrong, but... 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 ;) 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... No? Oleg.