diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2015-07-29 02:31:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-08-03 05:34:17 -0400 |
commit | ed79e946732e5311934d7f404b3b4e702e45cb97 (patch) | |
tree | 707e84f82e9b7f07c9638671ccbb85807fdcdfaf | |
parent | 3bbfafb77a06327fa1bc9f19bc55b5c558475091 (diff) |
s390/uaccess, locking/static_keys: employ static_branch_likely()
Use the new static_branch_likely() primitive to make sure that the
most likely case is executed without taking an unconditional branch.
This wasn't possible with the old jump label primitives.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/20150729064600.GB3953@osiris
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/s390/lib/uaccess.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c index 4614d415bb58..93cb1d09493d 100644 --- a/arch/s390/lib/uaccess.c +++ b/arch/s390/lib/uaccess.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <asm/mmu_context.h> | 15 | #include <asm/mmu_context.h> |
16 | #include <asm/facility.h> | 16 | #include <asm/facility.h> |
17 | 17 | ||
18 | static struct static_key have_mvcos = STATIC_KEY_INIT_FALSE; | 18 | static DEFINE_STATIC_KEY_FALSE(have_mvcos); |
19 | 19 | ||
20 | static inline unsigned long copy_from_user_mvcos(void *x, const void __user *ptr, | 20 | static inline unsigned long copy_from_user_mvcos(void *x, const void __user *ptr, |
21 | unsigned long size) | 21 | unsigned long size) |
@@ -104,7 +104,7 @@ static inline unsigned long copy_from_user_mvcp(void *x, const void __user *ptr, | |||
104 | 104 | ||
105 | unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | 105 | unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) |
106 | { | 106 | { |
107 | if (static_key_false(&have_mvcos)) | 107 | if (static_branch_likely(&have_mvcos)) |
108 | return copy_from_user_mvcos(to, from, n); | 108 | return copy_from_user_mvcos(to, from, n); |
109 | return copy_from_user_mvcp(to, from, n); | 109 | return copy_from_user_mvcp(to, from, n); |
110 | } | 110 | } |
@@ -177,7 +177,7 @@ static inline unsigned long copy_to_user_mvcs(void __user *ptr, const void *x, | |||
177 | 177 | ||
178 | unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) | 178 | unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) |
179 | { | 179 | { |
180 | if (static_key_false(&have_mvcos)) | 180 | if (static_branch_likely(&have_mvcos)) |
181 | return copy_to_user_mvcos(to, from, n); | 181 | return copy_to_user_mvcos(to, from, n); |
182 | return copy_to_user_mvcs(to, from, n); | 182 | return copy_to_user_mvcs(to, from, n); |
183 | } | 183 | } |
@@ -240,7 +240,7 @@ static inline unsigned long copy_in_user_mvc(void __user *to, const void __user | |||
240 | 240 | ||
241 | unsigned long __copy_in_user(void __user *to, const void __user *from, unsigned long n) | 241 | unsigned long __copy_in_user(void __user *to, const void __user *from, unsigned long n) |
242 | { | 242 | { |
243 | if (static_key_false(&have_mvcos)) | 243 | if (static_branch_likely(&have_mvcos)) |
244 | return copy_in_user_mvcos(to, from, n); | 244 | return copy_in_user_mvcos(to, from, n); |
245 | return copy_in_user_mvc(to, from, n); | 245 | return copy_in_user_mvc(to, from, n); |
246 | } | 246 | } |
@@ -312,7 +312,7 @@ static inline unsigned long clear_user_xc(void __user *to, unsigned long size) | |||
312 | 312 | ||
313 | unsigned long __clear_user(void __user *to, unsigned long size) | 313 | unsigned long __clear_user(void __user *to, unsigned long size) |
314 | { | 314 | { |
315 | if (static_key_false(&have_mvcos)) | 315 | if (static_branch_likely(&have_mvcos)) |
316 | return clear_user_mvcos(to, size); | 316 | return clear_user_mvcos(to, size); |
317 | return clear_user_xc(to, size); | 317 | return clear_user_xc(to, size); |
318 | } | 318 | } |
@@ -386,7 +386,7 @@ early_param("uaccess_primary", parse_uaccess_pt); | |||
386 | static int __init uaccess_init(void) | 386 | static int __init uaccess_init(void) |
387 | { | 387 | { |
388 | if (!uaccess_primary && test_facility(27)) | 388 | if (!uaccess_primary && test_facility(27)) |
389 | static_key_slow_inc(&have_mvcos); | 389 | static_branch_enable(&have_mvcos); |
390 | return 0; | 390 | return 0; |
391 | } | 391 | } |
392 | early_initcall(uaccess_init); | 392 | early_initcall(uaccess_init); |