[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190419190538.GC251571@google.com>
Date: Fri, 19 Apr 2019 15:05:38 -0400
From: Joel Fernandes <joel@...lfernandes.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Daniel Colascione <dancol@...gle.com>,
Jonathan Kowalski <bl0pbl33p@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Steven Rostedt <rostedt@...dmis.org>,
Christian Brauner <christian@...uner.io>,
Jann Horn <jannh@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Al Viro <viro@...iv.linux.org.uk>,
Andrei Vagin <avagin@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Kees Cook <keescook@...omium.org>,
Linux FS Devel <linux-fsdevel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>, Michal Hocko <mhocko@...e.com>,
Nadav Amit <namit@...are.com>, Serge Hallyn <serge@...lyn.com>,
Shuah Khan <shuah@...nel.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Taehee Yoo <ap420073@...il.com>, Tejun Heo <tj@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Android Kernel Team <kernel-team@...roid.com>,
Tycho Andersen <tycho@...ho.ws>
Subject: Re: [PATCH RFC 1/2] Add polling support to pidfd
On Thu, Apr 18, 2019 at 12:14:58PM -0700, Linus Torvalds wrote:
> On Thu, Apr 18, 2019 at 11:58 AM Daniel Colascione <dancol@...gle.com> wrote:
> >
> > On Thu, Apr 18, 2019 at 11:44 AM Jonathan Kowalski <bl0pbl33p@...il.com> wrote:
> > >
> > > Would using something other than POLLIN be an option (maybe POLLPRI)?
> > > The convention is to use it to indicate readability on the descriptor,
> > > and also possibly POLLHUP instead of POLLERR (the latter is less of a
> > > problem, but FreeBSD also does the same, so it'd help with some
> > > consistency for libraries wanting to use this, which aren't interested
> > > in other sub states).
> >
> > Existing event loop libraries generally support checking only for
> > readability and writability. Not setting POLLIN would make these FDs
> > more difficult to use with existing event loop libraries. What
> > advantage would compensate for this difficulty?
>
> Right.
>
> Usually you'd set POLLIN in _addition_ to any other more specialized poll flag.
>
> For example, when a socket has shut down the read side, we do
>
> if (sk->sk_shutdown & RCV_SHUTDOWN)
> mask |= EPOLLRDHUP | EPOLLIN | EPOLLRDNORM;
>
> because while it's true that EPOLLRDHUP is the most _specific_ poll
> bit, it's _also_ true that a read shutdown means that the read() will
> return immediately.
>
> So generally a HUP condition should mean that POLLIN and POLLOUT also
> get set. Not because there's any actual _data_ to be read, but simply
> because the read will not block.
Sounds great and I agree with Linus and Daniel. So I am guessing you are Ok
with the current set of flags proposed this patch, so I will keep them intact
in future patch postings. But please let me know if you want me to change
something about the flags.
thanks!
- Joel
Powered by blists - more mailing lists