linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	David Laight <David.Laight@aculab.com>,
	Linux FS-devel Mailing List <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>,
	linux-man <linux-man@vger.kernel.org>,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH v3 1/2] epoll: add nsec timeout support with epoll_pwait2
Date: Fri, 20 Nov 2020 11:01:01 -0500	[thread overview]
Message-ID: <CAF=yD-Lzu9j6T4ubRjawF-EKOC3pkQTkpigg=PugWwybY-1ZyQ@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a21JRFUJrz1+TYWcVL8s4uSfeSFyoMkGsqUPbV+F=r_yw@mail.gmail.com>

On Fri, Nov 20, 2020 at 3:13 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> On Thu, Nov 19, 2020 at 9:13 PM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> > On Thu, Nov 19, 2020 at 10:45 AM Arnd Bergmann <arnd@kernel.org> wrote:
> > > On Thu, Nov 19, 2020 at 3:31 PM Matthew Wilcox <willy@infradead.org> wrote:
> > > The right shift would work indeed, but it's also a bit ugly unless
> > > __estimate_accuracy() is changed to always use the same shift.
> > >
> > > I see that on 32-bit ARM, select_estimate_accuracy() calls
> > > the external __aeabi_idiv() function to do the 32-bit division, so
> > > changing it to a shift would speed up select as well.
> > >
> > > Changing select_estimate_accuracy() to take the relative timeout
> > > as an argument to avoid the extra ktime_get_ts64() should
> > > have a larger impact.
> >
> > It could be done by having poll_select_set_timeout take an extra u64*
> > slack, call select_estimate_accuracy before adding in the current time
> > and then pass the slack down to do_select and do_sys_poll, also
> > through core_sys_select and compat_core_sys_select.
> >
> > It could be a patch independent from this new syscall. Since it changes
> > poll_select_set_timeout it clearly has a conflict with the planned next
> > revision of this. I can include it in the next patchset to decide whether
> > it's worth it.
>
> Yes, that sounds good, not sure how much rework this would require.
>
> It would be easier to do if we first merged the native and compat
> native versions of select/pselect/ppoll by moving the
> in_compat_syscall() check into combined get_sigset()
> and get_fd_set() helpers. I would assume you have enough
> on your plate already and don't want to add that to it.

Thanks for the suggestion.

I do have an initial patchset. As expected, it does involve quite a
bit of code churn to pass slack through the callers. I'll take a look
at your suggestion to simplify it.

As is, the patchset is not ready to send to the list for possible
merge. In the meantime, I did push the patchset to github at
https://github.com/wdebruij/linux/commits/epoll-nstimeo-1 . I can send
a version marked RFC to the list if that's easier.

I made the slack specific changes in two separate patches, one to
fs/select.c and one to fs/eventpoll.c, and placed these at the end of
the patchset. So we could first finish the syscall and then send this
as a separate patchset if it proves complex enough.

Btw, the other change, to convert epoll implementation to timespec64
before adding the syscall, equally adds some code churn compared to
patch v3. But perhaps the end state is cleaner and more consistent.

> > > I don't see a problem with an s64 timeout if that makes the interface
> > > simpler by avoiding differences between the 32-bit and 64-bit ABIs.
> > >
> > > More importantly, I think it should differ from poll/select by calculating
> > > and writing back the remaining timeout.
> > >
> > > I don't know what the latest view on absolute timeouts at the syscall
> > > ABI is, it would probably simplify the implementation, but make it
> > > less consistent with the others. Futex uses absolute timeouts, but
> > > is itself inconsistent about that.
> >
> > If the implementation internally uses poll_select_set_timeout and
> > passes around timespec64 *, it won't matter much in terms of
> > performance or implementation. Then there seems to be no downside to
> > following the consistency argument.
>
> Ok. So to clarify, you would stay with relative __kernel_timespec
> pointers and not copy back the remaining time, correct?

That's my understanding, and the current implementation.

  reply	other threads:[~2020-11-20 16:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 14:46 [PATCH v3 0/2] add epoll_pwait2 syscall Willem de Bruijn
2020-11-18 14:46 ` [PATCH v3 1/2] epoll: add nsec timeout support with epoll_pwait2 Willem de Bruijn
2020-11-18 15:00   ` Matthew Wilcox
2020-11-18 15:10     ` Willem de Bruijn
2020-11-18 15:37       ` Arnd Bergmann
2020-11-18 15:59         ` David Laight
2020-11-19 14:19           ` Willem de Bruijn
2020-11-19 14:31             ` Matthew Wilcox
2020-11-19 15:37               ` Willem de Bruijn
2020-11-19 15:45               ` Arnd Bergmann
2020-11-19 20:13                 ` Willem de Bruijn
2020-11-20  8:13                   ` Arnd Bergmann
2020-11-20 16:01                     ` Willem de Bruijn [this message]
2020-11-20 19:23                       ` Arnd Bergmann
2020-11-20 22:28                         ` Willem de Bruijn
2020-11-21  9:27                           ` Arnd Bergmann
2020-12-10 17:33                             ` Willem de Bruijn
2020-12-10 20:34                               ` Arnd Bergmann
2020-12-10 22:59                                 ` Willem de Bruijn
2021-01-11 20:06                                   ` Willem de Bruijn
2020-11-18 16:21   ` Willem de Bruijn
2020-11-18 16:50     ` Arnd Bergmann
2020-11-19  3:22       ` Willem de Bruijn
2020-11-18 14:46 ` [PATCH manpages RFC] epoll_wait.2: add epoll_pwait2 Willem de Bruijn
2020-11-18 14:46 ` [PATCH v3 2/2] selftests/filesystems: expand epoll with epoll_pwait2 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-Lzu9j6T4ubRjawF-EKOC3pkQTkpigg=PugWwybY-1ZyQ@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=shuochen@google.com \
    --cc=soheil.kdev@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willemb@google.com \
    --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).