Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-30 Thread Joel Fernandes
On Tue, Apr 30, 2019 at 01:53:33PM +0200, Oleg Nesterov wrote: > On 04/29, Joel Fernandes wrote: > > > > On Mon, Apr 29, 2019 at 04:20:30PM +0200, Oleg Nesterov wrote: > > > On 04/29, Joel Fernandes wrote: > > > > > > > > However, in your code above, it is avoided because we get: > > > > > > > >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-30 Thread Oleg Nesterov
On 04/30, Oleg Nesterov wrote: > > > > pidfd_poll() can race with the exiting task, miss exit_code != 0, and > > > return > > > zero. However, do_poll() won't block after that and pidfd_poll() will be > > > called > > > again. > > > > Here also I didn't follow what you mean. If exit_code is read

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-30 Thread Oleg Nesterov
On 04/29, Joel Fernandes wrote: > > On Mon, Apr 29, 2019 at 04:20:30PM +0200, Oleg Nesterov wrote: > > On 04/29, Joel Fernandes wrote: > > > > > > However, in your code above, it is avoided because we get: > > > > > > Task A (poller) Task B (exiting task being polled) > > >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-29 Thread Joel Fernandes
On Mon, Apr 29, 2019 at 04:20:30PM +0200, Oleg Nesterov wrote: > On 04/29, Joel Fernandes wrote: > > > > However, in your code above, it is avoided because we get: > > > > Task A (poller) Task B (exiting task being polled) > > > > poll() called

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-29 Thread Oleg Nesterov
On 04/29, Joel Fernandes wrote: > > On Mon, Apr 29, 2019 at 10:02:45AM -0400, Joel Fernandes wrote: > > On Sun, Apr 28, 2019 at 06:24:06PM +0200, Oleg Nesterov wrote: > [snip] > > > > > +{ > > > > > + struct pid *pid; > > > > > + > > > > > + lockdep_assert_held(_lock); > > > > > + > > > >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-29 Thread Oleg Nesterov
On 04/29, Joel Fernandes wrote: > > However, in your code above, it is avoided because we get: > > Task A (poller) Task B (exiting task being polled) > > poll() called > add_wait_queue() > exit_state is set to non-zero >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-29 Thread Joel Fernandes
On Mon, Apr 29, 2019 at 10:02:45AM -0400, Joel Fernandes wrote: > On Sun, Apr 28, 2019 at 06:24:06PM +0200, Oleg Nesterov wrote: [snip] > > > > +{ > > > > + struct pid *pid; > > > > + > > > > + lockdep_assert_held(_lock); > > > > + > > > > + pid = get_task_pid(task, PIDTYPE_PID);

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-29 Thread Joel Fernandes
On Sun, Apr 28, 2019 at 06:24:06PM +0200, Oleg Nesterov wrote: > Thanks for cc'ing me... > > On 04/26, Christian Brauner wrote: > > > > On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) wrote: > > > +static unsigned int pidfd_poll(struct file *file, struct > > > poll_table_struct

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-28 Thread Oleg Nesterov
Thanks for cc'ing me... On 04/26, Christian Brauner wrote: > > On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) wrote: > > +static unsigned int pidfd_poll(struct file *file, struct poll_table_struct > > *pts) > > +{ > > + struct task_struct *task; > > + struct pid *pid; > >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-26 Thread Christian Brauner
On April 26, 2019 5:21:40 PM GMT+02:00, Christian Brauner wrote: >On Fri, Apr 26, 2019 at 10:23:37AM -0400, Joel Fernandes wrote: >> On Fri, Apr 26, 2019 at 12:24:04AM +0200, Christian Brauner wrote: >> > On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) >wrote: >> > > pidfd are

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-26 Thread Christian Brauner
On Fri, Apr 26, 2019 at 10:23:37AM -0400, Joel Fernandes wrote: > On Fri, Apr 26, 2019 at 12:24:04AM +0200, Christian Brauner wrote: > > On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) wrote: > > > pidfd are file descriptors referring to a process created with the > > >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-26 Thread Christian Brauner
On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) wrote: > pidfd are file descriptors referring to a process created with the > CLONE_PIDFD clone(2) flag. Android low memory killer (LMK) needs pidfd > polling support to replace code that currently checks for existence of >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-26 Thread Joel Fernandes
On Fri, Apr 26, 2019 at 12:24:04AM +0200, Christian Brauner wrote: > On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) wrote: > > pidfd are file descriptors referring to a process created with the > > CLONE_PIDFD clone(2) flag. Android low memory killer (LMK) needs pidfd > >

Re: [PATCH v1 1/2] Add polling support to pidfd

2019-04-25 Thread Christian Brauner
On Thu, Apr 25, 2019 at 03:00:09PM -0400, Joel Fernandes (Google) wrote: > pidfd are file descriptors referring to a process created with the > CLONE_PIDFD clone(2) flag. Android low memory killer (LMK) needs pidfd > polling support to replace code that currently checks for existence of >

[PATCH v1 1/2] Add polling support to pidfd

2019-04-25 Thread Joel Fernandes (Google)
pidfd are file descriptors referring to a process created with the CLONE_PIDFD clone(2) flag. Android low memory killer (LMK) needs pidfd polling support to replace code that currently checks for existence of /proc/pid for knowing that a process that is signalled to be killed has died, which is