From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Soheil Hassas Yeganeh <soheil.kdev@gmail.com>,
Arnd Bergmann <arnd@arndb.de>, Shuo Chen <shuochen@google.com>,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH v2] epoll: add nsec timeout support
Date: Mon, 16 Nov 2020 18:51:16 -0500 [thread overview]
Message-ID: <CAF=yD-JFjoYEiqNLMqM-mTFQ1qYsw7Py5oggyVesHo7burwumA@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-JJtAwse5keH5MxxtA1EY3nxV=Ormizzvd2FHOjWROk4A@mail.gmail.com>
On Mon, Nov 16, 2020 at 6:36 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> On Mon, Nov 16, 2020 at 3:04 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Mon, 16 Nov 2020 11:10:01 -0500 Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote:
> >
> > > From: Willem de Bruijn <willemb@google.com>
> > >
> > > Add epoll_create1 flag EPOLL_NSTIMEO. When passed, this changes the
> > > interpretation of argument timeout in epoll_wait from msec to nsec.
> > >
> > > Use cases such as datacenter networking operate on timescales well
> > > below milliseconds. Shorter timeouts bounds their tail latency.
> > > The underlying hrtimer is already programmed with nsec resolution.
> >
> > hm, maybe. It's not very nice to be using one syscall to alter the
> > interpretation of another syscall's argument in this fashion. For
> > example, one wonders how strace(1) is to properly interpret & display
> > this argument?
> >
> > Did you consider adding epoll_wait2()/epoll_pwait2() syscalls which
> > take a nsec timeout? Seems simpler.
>
> I took a first stab. The patch does become quite a bit more complex.
Not complex in terms of timeout logic. Just a bigger patch, taking as
example the recent commit ecb8ac8b1f14 that added process_madvise.
> I was not aware of how uncommon syscall argument interpretation
> contingent on internal object state really is. Yes, that can
> complicate inspection with strace, seccomp, ... This particular case
> seems benign to me. But perhaps it sets a precedent.
>
> A new nsec resolution epoll syscall would be analogous to pselect and
> ppoll, both of which switched to nsec resolution timespec.
>
> Since creating new syscalls is rare, add a flags argument at the same time?
>
> Then I would split the change in two: (1) add the new syscall with
> extra flags argument, (2) define flag EPOLL_WAIT_NSTIMEO to explicitly
> change the time scale of the timeout argument. To avoid easy mistakes
> by callers in absence of stronger typing.
Come to think of it, better to convert to timespec to both have actual
typing and consistency with ppoll/pselect.
> epoll_wait is missing from include/uapi/asm-generic/unistd.h as it is
> superseded by epoll_pwait. Following the same rationale, add
> epoll_pwait2 (only).
next prev parent reply other threads:[~2020-11-16 23:52 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
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 [this message]
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-JFjoYEiqNLMqM-mTFQ1qYsw7Py5oggyVesHo7burwumA@mail.gmail.com' \
--to=willemdebruijn.kernel@gmail.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=willemb@google.com \
/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).