From: Shakeel Butt <shakeel.butt@linux.dev>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Christian Brauner <christian@brauner.io>,
Shuah Khan <shuah@kernel.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Suren Baghdasaryan <surenb@google.com>,
Vlastimil Babka <vbabka@suse.cz>,
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 <oliver.sang@intel.com>,
John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH v4 1/4] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup
Date: Tue, 22 Oct 2024 17:20:07 -0700 [thread overview]
Message-ID: <qruy775a4vayqstswwaqxpqtp7mcckqa3tme64buzjts4zrmm7@la47lojzelhj> (raw)
In-Reply-To: <94a3210afe96c9d1d6f9460d7d37a43e5bc5f550.1729198898.git.lorenzo.stoakes@oracle.com>
On Thu, Oct 17, 2024 at 10:05:49PM GMT, Lorenzo Stoakes wrote:
> The means by which a pid is determined from a pidfd is duplicated, with
> some callers holding a reference to the (pid)fd, and others explicitly
> pinning the pid.
>
> Introduce __pidfd_get_pid() which narrows this to one approach of pinning
> the pid, with an optional output parameters for file->f_flags to avoid the
> need to hold onto a file to retrieve this.
>
> Additionally, allow the ability to open a pidfd by opening a /proc/<pid>
> directory, utilised by the pidfd_send_signal() system call, providing a
> pidfd_get_pid_proc() helper function to do so.
>
> Doing this allows us to eliminate open-coded pidfd pid lookup and to
> consistently handle this in one place.
>
> This lays the groundwork for a subsequent patch which adds a new sentinel
> pidfd to explicitly reference the current process (i.e. thread group
> leader) without the need for a pidfd.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
next prev parent reply other threads:[~2024-10-23 0:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 21:05 [PATCH v4 0/4] introduce PIDFD_SELF* sentinels Lorenzo Stoakes
2024-10-17 21:05 ` [PATCH v4 1/4] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup Lorenzo Stoakes
2024-10-23 0:20 ` Shakeel Butt [this message]
2024-10-17 21:05 ` [PATCH v4 2/4] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process Lorenzo Stoakes
2024-10-21 8:11 ` Lorenzo Stoakes
2024-10-23 0:53 ` Shakeel Butt
2024-10-23 7:18 ` Lorenzo Stoakes
2024-10-23 17:18 ` Shakeel Butt
2024-10-23 17:24 ` Lorenzo Stoakes
2024-10-17 21:05 ` [PATCH v4 3/4] selftests: pidfd: add pidfd.h UAPI wrapper Lorenzo Stoakes
2024-10-17 21:45 ` John Hubbard
2024-10-17 22:11 ` Shuah Khan
2024-10-17 22:22 ` John Hubbard
2024-10-18 6:49 ` Lorenzo Stoakes
2024-10-18 23:55 ` John Hubbard
2024-10-17 21:05 ` [PATCH v4 4/4] selftests: pidfd: add tests for PIDFD_SELF_* Lorenzo Stoakes
2024-10-25 8:10 ` kernel test robot
2024-10-25 8:48 ` Lorenzo Stoakes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=qruy775a4vayqstswwaqxpqtp7mcckqa3tme64buzjts4zrmm7@la47lojzelhj \
--to=shakeel.butt@linux.dev \
--cc=Liam.Howlett@oracle.com \
--cc=christian@brauner.io \
--cc=jhubbard@nvidia.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=oliver.sang@intel.com \
--cc=pedro.falcato@gmail.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox