public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Heiko Carstens <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, heiko.carstens@de.ibm.com,
	akpm@linux-foundation.org, peterz@infradead.org,
	paulmck@linux.vnet.ibm.com, tglx@linutronix.de
Subject: [tip:locking/core] s390/uaccess, locking/static_keys: employ static_branch_likely()
Date: Mon, 3 Aug 2015 10:03:56 -0700	[thread overview]
Message-ID: <tip-ed79e946732e5311934d7f404b3b4e702e45cb97@git.kernel.org> (raw)
In-Reply-To: <20150729064600.GB3953@osiris>

Commit-ID:  ed79e946732e5311934d7f404b3b4e702e45cb97
Gitweb:     http://git.kernel.org/tip/ed79e946732e5311934d7f404b3b4e702e45cb97
Author:     Heiko Carstens <heiko.carstens@de.ibm.com>
AuthorDate: Wed, 29 Jul 2015 08:31:24 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 3 Aug 2015 11:34:17 +0200

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>
---
 arch/s390/lib/uaccess.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c
index 4614d41..93cb1d0 100644
--- a/arch/s390/lib/uaccess.c
+++ b/arch/s390/lib/uaccess.c
@@ -15,7 +15,7 @@
 #include <asm/mmu_context.h>
 #include <asm/facility.h>
 
-static struct static_key have_mvcos = STATIC_KEY_INIT_FALSE;
+static DEFINE_STATIC_KEY_FALSE(have_mvcos);
 
 static inline unsigned long copy_from_user_mvcos(void *x, const void __user *ptr,
 						 unsigned long size)
@@ -104,7 +104,7 @@ static inline unsigned long copy_from_user_mvcp(void *x, const void __user *ptr,
 
 unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-	if (static_key_false(&have_mvcos))
+	if (static_branch_likely(&have_mvcos))
 		return copy_from_user_mvcos(to, from, n);
 	return copy_from_user_mvcp(to, from, n);
 }
@@ -177,7 +177,7 @@ static inline unsigned long copy_to_user_mvcs(void __user *ptr, const void *x,
 
 unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-	if (static_key_false(&have_mvcos))
+	if (static_branch_likely(&have_mvcos))
 		return copy_to_user_mvcos(to, from, n);
 	return copy_to_user_mvcs(to, from, n);
 }
@@ -240,7 +240,7 @@ static inline unsigned long copy_in_user_mvc(void __user *to, const void __user
 
 unsigned long __copy_in_user(void __user *to, const void __user *from, unsigned long n)
 {
-	if (static_key_false(&have_mvcos))
+	if (static_branch_likely(&have_mvcos))
 		return copy_in_user_mvcos(to, from, n);
 	return copy_in_user_mvc(to, from, n);
 }
@@ -312,7 +312,7 @@ static inline unsigned long clear_user_xc(void __user *to, unsigned long size)
 
 unsigned long __clear_user(void __user *to, unsigned long size)
 {
-	if (static_key_false(&have_mvcos))
+	if (static_branch_likely(&have_mvcos))
 			return clear_user_mvcos(to, size);
 	return clear_user_xc(to, size);
 }
@@ -386,7 +386,7 @@ early_param("uaccess_primary", parse_uaccess_pt);
 static int __init uaccess_init(void)
 {
 	if (!uaccess_primary && test_facility(27))
-		static_key_slow_inc(&have_mvcos);
+		static_branch_enable(&have_mvcos);
 	return 0;
 }
 early_initcall(uaccess_init);

      parent reply	other threads:[~2015-08-03 17:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 13:20 [PATCH -v2 0/8] jump_label: Another (better) static_key interface Peter Zijlstra
2015-07-28 13:20 ` [PATCH -v2 1/8] jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE Peter Zijlstra
2015-07-28 13:20 ` [PATCH -v2 2/8] jump_label: Rename JUMP_LABEL_TYPE_* Peter Zijlstra
2015-07-29 12:58   ` Borislav Petkov
2015-07-28 13:20 ` [PATCH -v2 3/8] jump_label: Add jump_entry_key() helper Peter Zijlstra
2015-07-28 13:20 ` [PATCH -v2 4/8] jump_label: Add static_key_{en,dis}able() helpers Peter Zijlstra
2015-07-28 13:21 ` [PATCH -v2 5/8] jump_label: Rework update logic Peter Zijlstra
2015-07-28 13:21 ` [PATCH -v2 6/8] jump_label: Add a new static_key interface Peter Zijlstra
2015-07-28 17:00   ` Rabin Vincent
2015-07-28 17:20     ` Peter Zijlstra
2015-07-29  6:43   ` Heiko Carstens
2015-07-29  7:19   ` Vlastimil Babka
2015-07-29  8:49     ` Peter Zijlstra
2015-08-03 19:03       ` Steven Rostedt
2015-08-03 19:18         ` Peter Zijlstra
2015-08-03 19:28           ` Steven Rostedt
2015-08-03 20:00             ` Peter Zijlstra
2015-08-03 21:57               ` Steven Rostedt
2015-08-04  3:37                 ` Borislav Petkov
2015-08-04  4:07                   ` Andy Lutomirski
2015-08-04  4:21                     ` Borislav Petkov
2015-08-04 12:06                   ` Steven Rostedt
2015-08-04 14:33                     ` Borislav Petkov
2015-08-04 14:41                       ` Steven Rostedt
2015-08-04 14:51                       ` Andy Lutomirski
2015-07-30 12:18   ` Michael Ellerman
2015-08-04  6:50   ` yalin wang
2015-08-04  9:15     ` Peter Zijlstra
2015-07-28 13:21 ` [PATCH -v2 7/8] jump_label: Add selftest Peter Zijlstra
2015-07-28 21:46   ` Jason Baron
2015-07-29  8:53     ` Peter Zijlstra
2015-07-28 13:21 ` [PATCH -v2 8/8] x86, tsc: Employ static_branch_likely() Peter Zijlstra
2015-07-29 14:07   ` Borislav Petkov
2015-07-29  6:46 ` [PATCH -v2 0/8] jump_label: Another (better) static_key interface Heiko Carstens
2015-07-29  8:58   ` Peter Zijlstra
2015-08-03 17:03   ` tip-bot for Heiko Carstens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-ed79e946732e5311934d7f404b3b4e702e45cb97@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox