linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: David Laight <David.Laight@aculab.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Soheil Hassas Yeganeh <soheil.kdev@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>, Shuo Chen <shuochen@google.com>
Subject: Re: [PATCH v2] epoll: add nsec timeout support
Date: Mon, 16 Nov 2020 14:54:17 -0500	[thread overview]
Message-ID: <CAF=yD-LGtfPGuqM8WP5Wz7d9_u6x-HdeBitKg81zdA8E6tMQwQ@mail.gmail.com> (raw)
In-Reply-To: <eead2765ea5e417abe616950b4e5d02f@AcuMS.aculab.com>

On Mon, Nov 16, 2020 at 12:11 PM David Laight <David.Laight@aculab.com> wrote:
>
> From: Willem de Bruijn
> > Sent: 16 November 2020 17:01
> >
> > On Mon, Nov 16, 2020 at 11:19 AM Matthew Wilcox <willy@infradead.org> wrote:
> > >
> > > On Mon, Nov 16, 2020 at 11:10:01AM -0500, Willem de Bruijn wrote:
> > > > diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h
> > > > index 8a3432d0f0dc..f6ef9c9f8ac2 100644
> > > > --- a/include/uapi/linux/eventpoll.h
> > > > +++ b/include/uapi/linux/eventpoll.h
> > > > @@ -21,6 +21,7 @@
> > > >
> > > >  /* Flags for epoll_create1.  */
> > > >  #define EPOLL_CLOEXEC O_CLOEXEC
> > > > +#define EPOLL_NSTIMEO 0x1
> > > >
> > > >  /* Valid opcodes to issue to sys_epoll_ctl() */
> > > >  #define EPOLL_CTL_ADD 1
> > >
> > > Not a problem with your patch, but this concerns me.  O_CLOEXEC is
> > > defined differently for each architecture, so we need to stay out of
> > > several different bits when we define new flags for EPOLL_*.  Maybe
> > > this:
> > >
> > > /*
> > >  * Flags for epoll_create1.  O_CLOEXEC may be different bits, depending
> > >  * on the CPU architecture.  Reserve the known ones.
> > >  */
> > > #define EPOLL_CLOEXEC           O_CLOEXEC
> > > #define EPOLL_RESERVED_FLAGS    0x00680000
> > > #define EPOLL_NSTIMEO           0x00000001
> >
> > Thanks. Good point, I'll add that in v3.
>
> You could also add a compile assert to check that the flag is reserved.

Like this?

        /* Check the EPOLL_* constant for consistency.  */
        BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);
+        BUILD_BUG_ON(EPOLL_NSTIMEO & EPOLL_RESERVED_FLAGS);

  reply	other threads:[~2020-11-16 19:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 16:10 [PATCH v2] epoll: add nsec timeout support Willem de Bruijn
2020-11-16 16:12 ` Soheil Hassas Yeganeh
2020-11-16 16:19 ` Matthew Wilcox
2020-11-16 17:00   ` Willem de Bruijn
2020-11-16 17:11     ` David Laight
2020-11-16 19:54       ` Willem de Bruijn [this message]
2020-11-16 20:00         ` Matthew Wilcox
2020-11-16 20:04 ` Andrew Morton
2020-11-16 23:36   ` Willem de Bruijn
2020-11-16 23:51     ` Willem de Bruijn
2020-11-17  0:37       ` Andrew Morton
2020-11-17  2:21         ` Willem de Bruijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF=yD-LGtfPGuqM8WP5Wz7d9_u6x-HdeBitKg81zdA8E6tMQwQ@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuochen@google.com \
    --cc=soheil.kdev@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).