Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1672909
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86/uaccess: use unrolled string copy for short strings |
| Date | 2017-06-22 19:40 +0200 |
| Message-ID | <tVefg-7PJ-9@gated-at.bofh.it> (permalink) |
| References | <tULPY-5nY-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jun 21, 2017 at 4:09 AM, Paolo Abeni <pabeni@redhat.com> wrote:
>
> + if (len <= 64)
> + return copy_user_generic_unrolled(to, from, len);
> +
> /*
> * If CPU has ERMS feature, use copy_user_enhanced_fast_string.
> * Otherwise, if CPU has rep_good feature, use copy_user_generic_string.
NAK. Please do *not* do this. It puts the check in completely the
wrong place for several reasons:
(a) it puts it in the inlined caller case (which could be ok for
constant sizes, but not in general)
(b) it uses the copy_user_generic_unrolled() function that will then
just test the size *AGAIN* against small cases.
so it's both bigger than necessary, and stupid.
So if you want to do this optimization, I'd argue that you should just
do it inside the copy_user_enhanced_fast_string() function itself, the
same way we already handle the really small case specially in
copy_user_generic_string().
And do *not* use the unrolled code, which isn't used for small copies
anyway - rewrite the "copy_user_generic_unrolled" function in that
same asm file to have the non-unrolled cases (label "17" and forward)
accessible, so that you don't bother re-testing the size.
Linus
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86/uaccess: use unrolled string copy for short strings Paolo Abeni <pabeni@redhat.com> - 2017-06-21 13:20 +0200
Re: [PATCH] x86/uaccess: use unrolled string copy for short strings Kees Cook <keescook@chromium.org> - 2017-06-21 19:40 +0200
Re: [PATCH] x86/uaccess: use unrolled string copy for short strings Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-06-22 17:00 +0200
Re: [PATCH] x86/uaccess: use unrolled string copy for short strings Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:50 +0200
Re: [PATCH] x86/uaccess: use unrolled string copy for short strings Paolo Abeni <pabeni@redhat.com> - 2017-06-22 19:10 +0200
Re: [PATCH] x86/uaccess: use unrolled string copy for short strings Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-22 19:40 +0200
Re: [PATCH] x86/uaccess: use unrolled string copy for short strings Paolo Abeni <pabeni@redhat.com> - 2017-06-22 20:00 +0200
[PATCH] x86/uaccess: optimize copy_user_enhanced_fast_string for short string Paolo Abeni <pabeni@redhat.com> - 2017-06-29 16:00 +0200
Re: [PATCH] x86/uaccess: optimize copy_user_enhanced_fast_string for short string Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-29 23:50 +0200
[tip:x86/asm] x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings tip-bot for Paolo Abeni <tipbot@zytor.com> - 2017-06-30 15:20 +0200
csiph-web