From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754793AbbHCREg (ORCPT ); Mon, 3 Aug 2015 13:04:36 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40258 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754017AbbHCREa (ORCPT ); Mon, 3 Aug 2015 13:04:30 -0400 Date: Mon, 3 Aug 2015 10:03:56 -0700 From: tip-bot for Heiko Carstens Message-ID: 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 Reply-To: paulmck@linux.vnet.ibm.com, tglx@linutronix.de, heiko.carstens@de.ibm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, akpm@linux-foundation.org In-Reply-To: <20150729064600.GB3953@osiris> References: <20150729064600.GB3953@osiris> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] s390/uaccess, locking/static_keys: employ static_branch_likely() Git-Commit-ID: ed79e946732e5311934d7f404b3b4e702e45cb97 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ed79e946732e5311934d7f404b3b4e702e45cb97 Gitweb: http://git.kernel.org/tip/ed79e946732e5311934d7f404b3b4e702e45cb97 Author: Heiko Carstens AuthorDate: Wed, 29 Jul 2015 08:31:24 +0200 Committer: Ingo Molnar 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 Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/20150729064600.GB3953@osiris Signed-off-by: Ingo Molnar --- 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 #include -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);