[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200901161840.e5eo33ctmq7zavak@wittgenstein>
Date: Tue, 1 Sep 2020 18:18:40 +0200
From: Christian Brauner <christian.brauner@...ntu.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Christian Brauner <christian@...uner.io>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Kees Cook <keescook@...omium.org>,
Sargun Dhillon <sargun@...gun.me>,
Aleksa Sarai <cyphar@...har.com>,
linux-kselftest@...r.kernel.org,
Josh Triplett <josh@...htriplett.org>,
Jens Axboe <axboe@...nel.dk>, linux-api@...r.kernel.org,
Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH 2/4] exit: support non-blocking pidfds
On Tue, Sep 01, 2020 at 06:11:54PM +0200, Oleg Nesterov wrote:
> On 08/31, Christian Brauner wrote:
> >
> > --- a/kernel/exit.c
> > +++ b/kernel/exit.c
> > @@ -934,6 +934,7 @@ struct wait_opts {
> >
> > wait_queue_entry_t child_wait;
> > int notask_error;
> > + int eagain_error;
> > };
> >
> > static int eligible_pid(struct wait_opts *wo, struct task_struct *p)
> > @@ -1461,6 +1462,8 @@ static long do_wait(struct wait_opts *wo)
> >
> > notask:
> > retval = wo->notask_error;
> > + if (!retval)
> > + retval = wo->eagain_error;
> > if (!retval && !(wo->wo_flags & WNOHANG)) {
> > retval = -ERESTARTSYS;
>
> I must have missed something but I don't understand why do we need
> the new ->eagain_error and the change in do_wait().
>
> > @@ -1544,6 +1551,11 @@ static long kernel_waitid(int which, pid_t upid, struct waitid_info *infop,
> > wo.wo_flags = options;
> > wo.wo_info = infop;
> > wo.wo_rusage = ru;
> > + wo.eagain_error = 0;
> > + if (f_flags & O_NONBLOCK) {
> > + wo.wo_flags |= WNOHANG;
> > + wo.eagain_error = -EAGAIN;
> > + }
> > ret = do_wait(&wo);
>
> Can't kernel_waitid() simply do
>
> if (f_flags & O_NONBLOCK)
> wo.wo_flags |= WNOHANG;
> ret = do_wait();
> if (!ret & (f_flags & O_NONBLOCK))
> ret = -EAGAIN;
>
> ?
Heh, indeed, that's even a smaller patch. Will change to that!
Thanks for the review, Oleg!
Christia
Powered by blists - more mailing lists