From: David Laight <david.laight.linux@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
David Howells <dhowells@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH next 0/3] iov: Optimise user copies
Date: Sat, 22 Mar 2025 22:37:44 +0000 [thread overview]
Message-ID: <20250322223744.353bf74f@pumpkin> (raw)
In-Reply-To: <CAHk-=whs5oVkHMrNP=xkJP4Z4fObn=6Mz3fYp4wWMNQWtyjo9w@mail.gmail.com>
On Fri, 21 Mar 2025 16:35:52 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Fri, 21 Mar 2025 at 15:46, David Laight <david.laight.linux@gmail.com> wrote:
> >
> > The speculation barrier in access_ok() is expensive.
> >
> > The first patch removes the initial checks when reading the iovec[].
> > The checks are repeated before the actual copy.
> >
> > The second patch uses 'user address masking' if supported.
> >
> > The third removes a lot of code for single entry iovec[].
>
> Ack, except I'd really like to see numbers for things that claim to
> remove expensive stuff.
Except that some of the 'expensive stuff' is missing!
copy_from_user_iter() does:
if (access_ok())
raw_copy_from_user();
So it is missing the barrier_nospec().
The error handling is also different from _inline_copy_from_user().
(It doesn't zero-fill after a partial read.)
The observant will also notice that it is missing the massive
performance hit (and code bloat) of check_copy_size() (usercopy hardening).
Talking of performance I've dug out my clock cycle measuring code
(still full of different ipcsum functions).
I'm sure I got 12 bytes/clock on my i7-7 for the loop in the current kernel,
but it is only giving 10 today (possibly I don't have the latest version).
OTOH my new zen5 runs the adxo/adxc loop at 16 bytes/clock (i7-7 manages 12).
I'm going to try to find time for some memcpy() experiments.
David
>
> But yeah, the patches look sane.
>
> Linus
next prev parent reply other threads:[~2025-03-22 22:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 22:45 [PATCH next 0/3] iov: Optimise user copies David Laight
2025-03-21 22:45 ` [PATCH next 1/3] iov: Remove access_ok() from import_iovec() David Laight
2025-03-21 22:45 ` [PATCH next 2/3] iov: Use masked user accesses David Laight
2025-03-21 22:45 ` [PATCH next 3/3] iov: Optimise __import_iovec_ubuf() David Laight
2025-03-21 23:35 ` [PATCH next 0/3] iov: Optimise user copies Linus Torvalds
2025-03-22 10:08 ` David Laight
2025-03-22 22:37 ` David Laight [this message]
2025-03-29 11:31 ` David Laight
2025-03-22 14:36 ` Jens Axboe
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=20250322223744.353bf74f@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--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