Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Paolo Abeni
On Thu, 2017-06-22 at 10:30 -0700, Linus Torvalds wrote: > 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(). >

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Paolo Abeni
On Thu, 2017-06-22 at 10:30 -0700, Linus Torvalds wrote: > 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(). >

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Linus Torvalds
On Wed, Jun 21, 2017 at 4:09 AM, Paolo Abeni 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

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Linus Torvalds
On Wed, Jun 21, 2017 at 4:09 AM, Paolo Abeni 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 >

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Paolo Abeni
On Thu, 2017-06-22 at 10:47 +0200, Ingo Molnar wrote: > * Paolo Abeni wrote: > > > The 'rep' prefix suffers for a relevant "setup cost"; as a result > > string copies with unrolled loops are faster than even > > optimized string copy using 'rep' variant, for short string. > >

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Paolo Abeni
On Thu, 2017-06-22 at 10:47 +0200, Ingo Molnar wrote: > * Paolo Abeni wrote: > > > The 'rep' prefix suffers for a relevant "setup cost"; as a result > > string copies with unrolled loops are faster than even > > optimized string copy using 'rep' variant, for short string. > > > > This change

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Alan Cox
> > diff --git a/arch/x86/include/asm/uaccess_64.h > > b/arch/x86/include/asm/uaccess_64.h > > index c5504b9..16a8871 100644 > > --- a/arch/x86/include/asm/uaccess_64.h > > +++ b/arch/x86/include/asm/uaccess_64.h > > @@ -28,6 +28,9 @@ copy_user_generic(void *to, const void *from, unsigned > >

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Alan Cox
> > diff --git a/arch/x86/include/asm/uaccess_64.h > > b/arch/x86/include/asm/uaccess_64.h > > index c5504b9..16a8871 100644 > > --- a/arch/x86/include/asm/uaccess_64.h > > +++ b/arch/x86/include/asm/uaccess_64.h > > @@ -28,6 +28,9 @@ copy_user_generic(void *to, const void *from, unsigned > >

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Ingo Molnar
* Paolo Abeni wrote: > The 'rep' prefix suffers for a relevant "setup cost"; as a result > string copies with unrolled loops are faster than even > optimized string copy using 'rep' variant, for short string. > > This change updates __copy_user_generic() to use the unrolled

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-22 Thread Ingo Molnar
* Paolo Abeni wrote: > The 'rep' prefix suffers for a relevant "setup cost"; as a result > string copies with unrolled loops are faster than even > optimized string copy using 'rep' variant, for short string. > > This change updates __copy_user_generic() to use the unrolled > version for small

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-21 Thread Kees Cook
On Wed, Jun 21, 2017 at 4:09 AM, Paolo Abeni wrote: > The 'rep' prefix suffers for a relevant "setup cost"; as a result > string copies with unrolled loops are faster than even > optimized string copy using 'rep' variant, for short string. > > This change updates

Re: [PATCH] x86/uaccess: use unrolled string copy for short strings

2017-06-21 Thread Kees Cook
On Wed, Jun 21, 2017 at 4:09 AM, Paolo Abeni wrote: > The 'rep' prefix suffers for a relevant "setup cost"; as a result > string copies with unrolled loops are faster than even > optimized string copy using 'rep' variant, for short string. > > This change updates __copy_user_generic() to use the