From: Al Viro <viro@zeniv.linux.org.uk>
To: Daniel Axtens <dja@axtens.net>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/select.c: batch user writes in do_sys_poll
Date: Thu, 13 Aug 2020 14:00:44 +0100 [thread overview]
Message-ID: <20200813130044.GW1236603@ZenIV.linux.org.uk> (raw)
In-Reply-To: <87wo22n5ez.fsf@dja-thinkpad.axtens.net>
On Thu, Aug 13, 2020 at 09:36:52PM +1000, Daniel Axtens wrote:
> Hi,
>
> >> Seem like this could simply use a copy_to_user to further simplify
> >> things?
> >
> > I'll benchmark it and find out.
>
> I tried this:
>
> for (walk = head; walk; walk = walk->next) {
> - struct pollfd *fds = walk->entries;
> - int j;
> -
> - for (j = 0; j < walk->len; j++, ufds++)
> - if (__put_user(fds[j].revents, &ufds->revents))
> - goto out_fds;
> + if (copy_to_user(ufds, walk->entries,
> + sizeof(struct pollfd) * walk->len))
> + goto out_fds;
> + ufds += walk->len;
> }
>
> With that approach, the poll2 microbenchmark (which polls 128 fds) is
> about as fast as v1.
>
> However, the poll1 microbenchmark, which polls just 1 fd, regresses a
> touch (<1% - ~2%) compared to the current code, although it's largely
> within the noise. Thoughts?
I'd go with copy_to_user() here; post such variant and I'll throw it into
-next after -rc1.
next prev parent reply other threads:[~2020-08-13 13:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 7:11 [PATCH] fs/select.c: batch user writes in do_sys_poll Daniel Axtens
2020-08-13 7:32 ` Christoph Hellwig
2020-08-13 8:48 ` Daniel Axtens
2020-08-13 11:36 ` Daniel Axtens
2020-08-13 12:23 ` David Laight
2020-08-13 13:00 ` Al Viro [this message]
2020-08-13 9:01 ` David Laight
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=20200813130044.GW1236603@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dja@axtens.net \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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