summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2016-06-13 10:17:20 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-06-13 15:58:25 +0200
commitee64baf4ea3b7affb7e325bb3d188515ec4bb66e (patch)
treee99c82a4efe621de6d6683fc5af366aef5d807ca
parentb8ac5e2f4d8659961d2e0aea5475a07fb4eeec2d (diff)
downloadop-kernel-dev-ee64baf4ea3b7affb7e325bb3d188515ec4bb66e.zip
op-kernel-dev-ee64baf4ea3b7affb7e325bb3d188515ec4bb66e.tar.gz
s390/uaccess: use __builtin_expect for get_user/put_user
We always expect that get_user and put_user return with zero. Give the compiler a hint so it can slightly optimize the code and avoid branches. This is the same what x86 got with commit a76cf66e948a ("x86/uaccess: Tell the compiler that uaccess is unlikely to fault"). Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/uaccess.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index e0900dd..2ea7f32 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -191,7 +191,7 @@ static inline int __get_user_fn(void *x, const void __user *ptr, unsigned long s
__put_user_bad(); \
break; \
} \
- __pu_err; \
+ __builtin_expect(__pu_err, 0); \
})
#define put_user(x, ptr) \
@@ -240,7 +240,7 @@ int __put_user_bad(void) __attribute__((noreturn));
__get_user_bad(); \
break; \
} \
- __gu_err; \
+ __builtin_expect(__gu_err, 0); \
})
#define get_user(x, ptr) \
OpenPOWER on IntegriCloud