From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753273AbdHJMRj (ORCPT ); Thu, 10 Aug 2017 08:17:39 -0400 Received: from terminus.zytor.com ([65.50.211.136]:43765 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752779AbdHJMRf (ORCPT ); Thu, 10 Aug 2017 08:17:35 -0400 Date: Thu, 10 Aug 2017 05:14:01 -0700 From: tip-bot for Marc Zyngier Message-ID: Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de, marc.zyngier@arm.com, torvalds@linux-foundation.org, mingo@kernel.org, peterz@infradead.org, leo.yan@linaro.org Reply-To: linux-kernel@vger.kernel.org, hpa@zytor.com, marc.zyngier@arm.com, tglx@linutronix.de, torvalds@linux-foundation.org, mingo@kernel.org, leo.yan@linaro.org, peterz@infradead.org In-Reply-To: <20170801080257.5056-2-marc.zyngier@arm.com> References: <20170801080257.5056-2-marc.zyngier@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] jump_label: Move CPU hotplug locking Git-Commit-ID: b70cecf4b6b72a9977576ab32cca0e24f286f517 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: b70cecf4b6b72a9977576ab32cca0e24f286f517 Gitweb: http://git.kernel.org/tip/b70cecf4b6b72a9977576ab32cca0e24f286f517 Author: Marc Zyngier AuthorDate: Tue, 1 Aug 2017 09:02:54 +0100 Committer: Ingo Molnar CommitDate: Thu, 10 Aug 2017 12:28:58 +0200 jump_label: Move CPU hotplug locking As we're about to rework the locking, let's move the taking and release of the CPU hotplug lock to locations that will make its reworking completely obvious. Signed-off-by: Marc Zyngier Signed-off-by: Peter Zijlstra (Intel) Cc: Leo Yan Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20170801080257.5056-2-marc.zyngier@arm.com Signed-off-by: Ingo Molnar --- kernel/jump_label.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/jump_label.c b/kernel/jump_label.c index f2ea678..161301f 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -83,6 +83,7 @@ void static_key_slow_inc(struct static_key *key) { int v, v1; + cpus_read_lock(); STATIC_KEY_CHECK_USE(); /* @@ -99,11 +100,12 @@ void static_key_slow_inc(struct static_key *key) */ for (v = atomic_read(&key->enabled); v > 0; v = v1) { v1 = atomic_cmpxchg(&key->enabled, v, v + 1); - if (likely(v1 == v)) + if (likely(v1 == v)) { + cpus_read_unlock(); return; + } } - cpus_read_lock(); jump_label_lock(); if (atomic_read(&key->enabled) == 0) { atomic_set(&key->enabled, -1);