[PATCH 13/13] x86: drop cond rescheds from __copy_{from,to}_user

From: Andi Kleen
Date: Fri Aug 09 2013 - 19:07:00 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

The __copy_* variants are right now more expensive than the non __ copy*user
in CONFIG_PREEMPT_VOLUNTARY because they have a additional function call to
might_fault().

Since they are usually used in a row with other functions, which also
schedule or only in the thin compat layers and also __get/__put_user
do not do explicit reschedule check drop them here for the non debug
case.

Normal non __ copy*user will still schedule of course

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
arch/x86/include/asm/uaccess_32.h | 6 +++---
arch/x86/include/asm/uaccess_64.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index 7f760a9..e656ee9 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
@@ -81,7 +81,7 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
static __always_inline unsigned long __must_check
__copy_to_user(void __user *to, const void *from, unsigned long n)
{
- might_fault();
+ might_fault_debug_only();
return __copy_to_user_inatomic(to, from, n);
}

@@ -136,7 +136,7 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
static __always_inline unsigned long
__copy_from_user(void *to, const void __user *from, unsigned long n)
{
- might_fault();
+ might_fault_debug_only();
if (__builtin_constant_p(n)) {
unsigned long ret;

@@ -158,7 +158,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
static __always_inline unsigned long __copy_from_user_nocache(void *to,
const void __user *from, unsigned long n)
{
- might_fault();
+ might_fault_debug_only();
if (__builtin_constant_p(n)) {
unsigned long ret;

diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 831f4a3..86959f5 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -122,7 +122,7 @@ int __copy_from_user_nocheck(void *dst, const void __user *src, unsigned size)
static __always_inline __must_check
int __copy_from_user(void *dst, const void __user *src, unsigned size)
{
- might_fault();
+ might_fault_debug_only();
return __copy_from_user_nocheck(dst, src, size);
}

@@ -172,7 +172,7 @@ int __copy_to_user_nocheck(void __user *dst, const void *src, unsigned size)
static __always_inline __must_check
int __copy_to_user(void __user *dst, const void *src, unsigned size)
{
- might_fault();
+ might_fault_debug_only();
return __copy_to_user_nocheck(dst, src, size);
}

--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/