diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-03 16:38:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-03 16:38:28 -0400 |
commit | 48b5259cf0a2b86b978da122f9459e22a2d1e8f6 (patch) | |
tree | ced4acaed86bc4529458dd6b246ccae2ff2f0793 | |
parent | 2a275382a4f78f386db3473d9bb9987580de3cf4 (diff) | |
parent | 236222d39347e0e486010f10c1493e83dbbdfba8 (diff) |
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm updates from Ingo Molnar:
"A single commit micro-optimizing short user copies on certain Intel
CPUs"
* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings
-rw-r--r-- | arch/x86/lib/copy_user_64.S | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S index c5959576c315..020f75cc8cf6 100644 --- a/arch/x86/lib/copy_user_64.S +++ b/arch/x86/lib/copy_user_64.S | |||
@@ -37,7 +37,7 @@ ENTRY(copy_user_generic_unrolled) | |||
37 | movl %edx,%ecx | 37 | movl %edx,%ecx |
38 | andl $63,%edx | 38 | andl $63,%edx |
39 | shrl $6,%ecx | 39 | shrl $6,%ecx |
40 | jz 17f | 40 | jz .L_copy_short_string |
41 | 1: movq (%rsi),%r8 | 41 | 1: movq (%rsi),%r8 |
42 | 2: movq 1*8(%rsi),%r9 | 42 | 2: movq 1*8(%rsi),%r9 |
43 | 3: movq 2*8(%rsi),%r10 | 43 | 3: movq 2*8(%rsi),%r10 |
@@ -58,7 +58,8 @@ ENTRY(copy_user_generic_unrolled) | |||
58 | leaq 64(%rdi),%rdi | 58 | leaq 64(%rdi),%rdi |
59 | decl %ecx | 59 | decl %ecx |
60 | jnz 1b | 60 | jnz 1b |
61 | 17: movl %edx,%ecx | 61 | .L_copy_short_string: |
62 | movl %edx,%ecx | ||
62 | andl $7,%edx | 63 | andl $7,%edx |
63 | shrl $3,%ecx | 64 | shrl $3,%ecx |
64 | jz 20f | 65 | jz 20f |
@@ -174,6 +175,8 @@ EXPORT_SYMBOL(copy_user_generic_string) | |||
174 | */ | 175 | */ |
175 | ENTRY(copy_user_enhanced_fast_string) | 176 | ENTRY(copy_user_enhanced_fast_string) |
176 | ASM_STAC | 177 | ASM_STAC |
178 | cmpl $64,%edx | ||
179 | jb .L_copy_short_string /* less then 64 bytes, avoid the costly 'rep' */ | ||
177 | movl %edx,%ecx | 180 | movl %edx,%ecx |
178 | 1: rep | 181 | 1: rep |
179 | movsb | 182 | movsb |