Thread (44 messages) flat view 44 messages, 4 authors, 2024-02-01

Re: [PATCH v3 1/3] pidfd: allow pidfd_open() on non-thread-group leaders

From: Christian Brauner <brauner@kernel.org>
Date: 2024-01-26 09:49:07
Also in: lkml

On Thu, Jan 25, 2024 at 11:36:50AM -0700, Tycho Andersen wrote:
On Thu, Jan 25, 2024 at 07:30:46PM +0100, Oleg Nesterov wrote:
quoted
On 01/25, Oleg Nesterov wrote:
quoted
On 01/25, Tycho Andersen wrote:
quoted
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().)
quoted
quoted
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.
Yes, let's rather do the explicit PIDFD_THREAD.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help