From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 716993987D; Thu, 30 Jan 2025 22:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738276676; cv=none; b=Ye6jMtcIyli/UlU8zMA/qr6UR0QuNpfDDDByOH0ZoY/DRGfCYB+C4ZsEOYLWRZepS9o4ywZTg2wupPENQqK3YHeJJO/SWepht6KR06cRVYTYMcbV0nkwA4UgI/nBDazIZT7CGcb1c6Qc7BMyRBu9CopU7jbCfhj0Rz7WQNK6zKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738276676; c=relaxed/simple; bh=RsT+cN+IqZrca/sfcUXS4hAuAouyjftXrA3xfHri/m8=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=lu6NzDLcVebsfV249LefiSTTB/r4mMMAxPdX049CxT8QmdpgIP4oR671kaV33UAkp6/l0qwsOM2qoYQOeZSTkasQKGjncumv/72mhcPQ84Dg+k5YqrFDY+j545Iq1/BFCL4/2wYqg7ZnpnGyoZjcFQZ79rZFJxayV3nCOu6eEac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=qhz+CEhX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="qhz+CEhX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D887C4CED2; Thu, 30 Jan 2025 22:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1738276675; bh=RsT+cN+IqZrca/sfcUXS4hAuAouyjftXrA3xfHri/m8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qhz+CEhXICkn0jM8lJT8fdw57VIsg72Lz0XhZHpDVAWpeM2PKCSs1x7elh59mqcJU vXJwfAUj/PYIeBgmH7lalHq3R2muaTnviixMFnft70NgqqKKJbxOr6d/DbMoV3Oi22 kOFWUI8NEtokisuK+fCLAVpZ4LpfVx/d8Zp4kbnQ= Date: Thu, 30 Jan 2025 14:37:54 -0800 From: Andrew Morton To: Lorenzo Stoakes Cc: Christian Brauner , Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard , Tejun Heo , Johannes Weiner , Michal Koutny , Shakeel Butt Subject: Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels Message-Id: <20250130143754.1b8bb87bfb15175dd434529b@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 30 Jan 2025 20:40:25 +0000 Lorenzo Stoakes wrote: > If you wish to utilise a pidfd interface to refer to the current process or > thread it is rather cumbersome, requiring something like: > > int pidfd = pidfd_open(getpid(), 0 or PIDFD_THREAD); > > ... > > close(pidfd); > > Or the equivalent call opening /proc/self. It is more convenient to use a > sentinel value to indicate to an interface that accepts a pidfd that we > simply wish to refer to the current process thread. > The above code sequence doesn't seem at all onerous. I'm not understanding why it's worth altering the kernel to permit this little shortcut?