From: Daniel Axtens <dja@axtens.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: viro@zeniv.linux.org.uk, 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 21:36:52 +1000 [thread overview]
Message-ID: <87wo22n5ez.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <87zh6zlynh.fsf@dja-thinkpad.axtens.net>
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?
Kind regards,
Daniel
>> Also please don't pointlessly add overly long lines.
>
> Weird, I ran the commit through checkpatch and it didn't pick it
> up. I'll check the next version more carefully.
>
> Regards,
> Daniel
next prev parent reply other threads:[~2020-08-13 11:37 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 [this message]
2020-08-13 12:23 ` David Laight
2020-08-13 13:00 ` Al Viro
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=87wo22n5ez.fsf@dja-thinkpad.axtens.net \
--to=dja@axtens.net \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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