Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp145471rdb; Thu, 25 Jan 2024 10:38:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnGCWGAyX8WLFLE/yzHYr0dU8b3/U6I7pSkh1iWHtwgzxyPYbROkf34oAYl7mmerzKTzPu X-Received: by 2002:a17:902:d2c6:b0:1d8:8a60:5f63 with SMTP id n6-20020a170902d2c600b001d88a605f63mr124133plc.9.1706207889434; Thu, 25 Jan 2024 10:38:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706207889; cv=pass; d=google.com; s=arc-20160816; b=m+6gKCZkoRt8bEEIQy8UGCb8BIpe7k5w0QkxHHzzAx9Uh+usxGrvWdnI5YEmZxzVS4 IBlpXnsSZphpUo2CJv+JUdrnWw5CVuKsoxroX/lTfyFu+00CQcaWRb+y17a0hsLOCMnR mi1IZBQCjAByN8BJJjLdxdJAXBJNgoZl30ahzTpNkEAggPy35224yf63TVkNuYXwYZvJ pfF+pa6L0o5ml3KaoUvVFNgfJlMNF3hI7qd0UEltZb7DRSOdt1iwynUpYFPNBkJYDuSX /jyLNey8rULRG6D8bN9fKvkSrtzTcY5s8KeZ8f1VSmckLF9qCp5FMlJIHGkv/8Lw4WBm wG5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=CfjLibIYa5BzwhBwoi4+HVAjuBeEwvxGVOrZM+/ntKI=; fh=+pQQVWC6LKwXuTBmhlwvzqB5oDujtV1dR/Djy78dDYY=; b=ocH3OC6K5h5qqt9Zys0bliVQ6kKMNUKkboCfpNYgRSLN7XyYvilDE9tAbtQlXDvfYB pKoBD8V8+pr4HCWaL4meJKYWCTOsO4fDdJ68zJWU2yy05U5oyk3+ZaZal/tVx941HEkn cfpreDzW//BdhGI6ufRcgbxc4eqn7uL+JtcuKoLEvQsPdGxejfmio29FVBxRAZSraHDy e5NeQbjtdotjMwLtswIO5GAIWMn8thQzN332v1dwSO6Mts/XVkYDHs/A4lcubRakWZWW txPnO/1+vn0gxmjojCBgN0K98C5IITguc6oFwucXMS45uTqILg2jYIyZByW/E+IhKMUi Ljeg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm2 header.b=RycUwXwz; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ElM0XVZM; arc=pass (i=1 spf=pass spfdomain=tycho.pizza dkim=pass dkdomain=tycho.pizza dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-39133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39133-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o6-20020a1709026b0600b001cc4aca5f5dsi13362472plk.636.2024.01.25.10.38.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 10:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm2 header.b=RycUwXwz; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ElM0XVZM; arc=pass (i=1 spf=pass spfdomain=tycho.pizza dkim=pass dkdomain=tycho.pizza dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-39133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39133-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8A1EB28430F for ; Thu, 25 Jan 2024 18:37:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B77B10A12; Thu, 25 Jan 2024 18:37:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tycho.pizza header.i=@tycho.pizza header.b="RycUwXwz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ElM0XVZM" Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C95D779C7; Thu, 25 Jan 2024 18:36:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.26 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706207817; cv=none; b=ixgJ/UebfuGXPAs4snDJnCKxgi+B7B6oSDCnVFjPIDniDfiKA6Ct5Br/YMLSkR0Xol4PgEH0A69A+KjfgOnBewbKlPNFKOop+X3jYbRLNm/uRY7KQhKYKKq7RM/F97M90AKVp0QAtgZjNgnZU2iNpfrPGvSF8oZC2W0+GIQqamU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706207817; c=relaxed/simple; bh=UF54OoPnWhCHjd4YHoCkTUMl9/peohQTDd90vfCnJDY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g8pjlGxG6+wyWtB1j2kd8Pw3KRGAVhZS+R8kq+uVQz3v0g2mxiurPDFJmSPiM1m1WAMabrESHapxDqVDf1fPrOrlPlUM2Kw8ahDwdWzHVRgwu1h7VfQom0yUW8PDbBAURjbGNxJuVQ2FXFEDP9Yo+fYcAJPuPwY/y2uIGsGu3Ow= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tycho.pizza; spf=pass smtp.mailfrom=tycho.pizza; dkim=pass (2048-bit key) header.d=tycho.pizza header.i=@tycho.pizza header.b=RycUwXwz; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ElM0XVZM; arc=none smtp.client-ip=66.111.4.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tycho.pizza Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tycho.pizza Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AB4EE5C00D7; Thu, 25 Jan 2024 13:36:53 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 25 Jan 2024 13:36:53 -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:subject :subject:to:to; s=fm2; t=1706207813; x=1706294213; bh=CfjLibIYa5 BzwhBwoi4+HVAjuBeEwvxGVOrZM+/ntKI=; b=RycUwXwzL+doy0qtLxNp1VU07y SwLS1WBJ1YLm0mJ/p+6EVVWg0yBUpq5tzR/ofmG6Cx57dgNu31HHxZSQMPxMKxv0 uEynQonjsyl5J9oaPIoNi+MEVgnSBzUCwckX7zxLDZILn9y+4giy3c38SjHd6Xzs USgCpLeVnqkdFzDVWFw6VaSxd/FaMP9pIc32dM2RUZnAdC9Sg9Mv13sFwnXaro1n 3b7nJNzdrKkuv6wxXkuCPsQDYTjk6dZBEnEHuZg3IkmTINrp4/BkX89M0+TxzRB7 fjL4TOfN/Mr58CEdQqp+ZKqVgs5RqGcMelYXmY4CMK6KD+77y344JP4cA2Jw== 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:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706207813; x=1706294213; bh=CfjLibIYa5BzwhBwoi4+HVAjuBeE wvxGVOrZM+/ntKI=; b=ElM0XVZMzc6Ho5C5QpHT9YZQAny2m3zqD0CJ9+INRgcZ DDy6ltqdsporXE+mjPVFJzR8gXWZq3v1Y5B485Yp32g70Tf//IRPFXLHDQdTfJLr ekDlidYHqwTudhyHOBEb1mOgmUYmgqtb+Q7sobkXvZdPWQUikPMeKZ0WcAJMTjOL WSr6sJAiNUfRXCVwh1Vbh7CXXzri4qNDHJ6ch/mqGRL7j04RtHdjtTcWRh9wZW6z AvXAMBisgvEHv1dqZORUltSVJaXpZn8gDRkR0Tk4d/H2rcwMVyAeWAJDZO3qGNSD KpWjqGEKTx+Jue/DU7oBDIz75U2kOXh48NQtuSRzPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdelhedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepvfihtghh ohcutehnuggvrhhsvghnuceothihtghhohesthihtghhohdrphhiiiiirgeqnecuggftrf grthhtvghrnhepueettdetgfejfeffheffffekjeeuveeifeduleegjedutdefffetkeel hfelleetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epthihtghhohesthihtghhohdrphhiiiiirg X-ME-Proxy: Feedback-ID: i21f147d5:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Jan 2024 13:36:52 -0500 (EST) Date: Thu, 25 Jan 2024 11:36:50 -0700 From: Tycho Andersen To: Oleg Nesterov Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Tycho Andersen , "Eric W. Biederman" Subject: Re: [PATCH v3 1/3] pidfd: allow pidfd_open() on non-thread-group leaders Message-ID: References: <20240123153452.170866-1-tycho@tycho.pizza> <20240123153452.170866-2-tycho@tycho.pizza> <20240123195608.GB9978@redhat.com> <20240125140830.GA5513@redhat.com> <20240125-tricksen-baugrube-3f78c487a23a@brauner> <20240125175113.GC5513@redhat.com> <20240125182505.GD5513@redhat.com> <20240125183045.GE5513@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240125183045.GE5513@redhat.com> On Thu, Jan 25, 2024 at 07:30:46PM +0100, Oleg Nesterov wrote: > On 01/25, Oleg Nesterov wrote: > > > > On 01/25, Tycho Andersen wrote: > > > > > > One of the things I don't like about PIDFD_THREAD is that it's hard to > > > tell whether an arbitrary thread is a leader or not. Right now we do > > > it by parsing /proc/pid/status, which shows all the stuff from > > > do_task_stat() that we don't care about but which is quite expensive > > > to compute. (Maybe there's a better way?) > > > > > > With PIDFD_THREAD we could could do it twice, once with the flag, get > > > EINVAL, and then do it again. But ideally we wouldn't have to. > > > > Too late for me, most probably I misunderstood. > > > > If you want the PIDFD_THREAD behaviour, you can always use this flag > > without any check... Sorry, I hadn't read the patch. If it's ok to use PIDFD_THREAD on a leader, then we can just always specify it. (We don't care about the behavior of pidfd_poll().) > > Could you spell? > > Just in case, we can even add PIDFD_AUTO (modulo naming) which acts as > PIDFD_THREAD if the target task is not a leader or 0 (current behaviour) > otherwise. Trivial. Yep, or given the above, maybe it'll work as-is, thank you. Tycho