lkml.org 
[lkml]   [2024]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/1] pidfd: implement PIDFD_THREAD flag for pidfd_open()
On 01/31, Christian Brauner wrote:
>
> On Wed, Jan 31, 2024 at 02:26:02PM +0100, Oleg Nesterov wrote:
> > With this flag:
> >
> > - pidfd_open() doesn't require that the target task must be
> > a thread-group leader
> >
> > - pidfd_poll() succeeds when the task exits and becomes a
> > zombie (iow, passes exit_notify()), even if it is a leader
> > and thread-group is not empty.
> >
> > This means that the behaviour of pidfd_poll(PIDFD_THREAD,
> > pid-of-group-leader) is not well defined if it races with
> > exec() from its sub-thread; pidfd_poll() can succeed or not
> > depending on whether pidfd_task_exited() is called before
> > or after exchange_tids().
>
> I think that we can live with that for now. If it doesn't hinder Tycho's
> use-case it's fine.

OK, good.

> (I often wish that we could report custom data from poll similar to
> kqueue on bsd then we could attach file specific information to the
> notification. That would enable userspace to handle this the way they
> want.)

Or at least perhaps we can change do_notify_pidfd() to use the keyed
wakeups... I'll try to take a look later.

> > thread_group_exited() is no longer used, perhaps it can die.
>
> Feel free to add a patch for that on top of it.

Yes, will do.

Oleg.


\
 
 \ /
  Last update: 2024-05-27 14:43    [W:1.030 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site