From: David Laight <David.Laight@ACULAB.COM>
To: 'Daniel Axtens' <dja@axtens.net>, Christoph Hellwig <hch@infradead.org>
Cc: "viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@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 12:23:48 +0000 [thread overview]
Message-ID: <452dbcc5064646028dc8b9f5f3d57a5d@AcuMS.aculab.com> (raw)
In-Reply-To: <87wo22n5ez.fsf@dja-thinkpad.axtens.net>
From: Daniel Axtens
> Sent: 13 August 2020 12:37
>
> >> 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?
Is that with or without 'user copy hardening'?
Or use __copy_to_user() to skip all that 'crap'.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-08-13 12:23 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 [this message]
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=452dbcc5064646028dc8b9f5f3d57a5d@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=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;
as well as URLs for NNTP newsgroup(s).