From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751563AbeADRMz (ORCPT + 1 other); Thu, 4 Jan 2018 12:12:55 -0500 Received: from forwardcorp1j.cmail.yandex.net ([5.255.227.105]:33745 "EHLO forwardcorp1j.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbeADRMy (ORCPT ); Thu, 4 Jan 2018 12:12:54 -0500 Authentication-Results: smtpcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 1/2 v2] jump_label: export static_key_slow_inc/dec_cpuslocked() From: Konstantin Khlebnikov To: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org Cc: Thomas Gleixner Date: Thu, 04 Jan 2018 20:12:48 +0300 Message-ID: <151508596847.944422.2313251495458256593.stgit@buzz> In-Reply-To: <151501139053.928921.10437479983023205360.stgit@buzz> References: <151501139053.928921.10437479983023205360.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: For fixing cpu_hotplug_lock recursion in tg_set_cfs_bandwidth(). Signed-off-by: Konstantin Khlebnikov --- v2: remove EXPORT_SYMBOL_GPL, second patch unchanged --- include/linux/jump_label.h | 12 ++++++++++++ kernel/jump_label.c | 16 +++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index c7b368c734af..db10e6a9d315 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -160,6 +160,8 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry, extern int jump_label_text_reserved(void *start, void *end); extern void static_key_slow_inc(struct static_key *key); extern void static_key_slow_dec(struct static_key *key); +extern void static_key_slow_inc_cpuslocked(struct static_key *key); +extern void static_key_slow_dec_cpuslocked(struct static_key *key); extern void jump_label_apply_nops(struct module *mod); extern int static_key_count(struct static_key *key); extern void static_key_enable(struct static_key *key); @@ -222,6 +224,16 @@ static inline void static_key_slow_dec(struct static_key *key) atomic_dec(&key->enabled); } +static inline void static_key_slow_inc_cpuslocked(struct static_key *key) +{ + static_key_slow_inc(key); +} + +static inline void static_key_slow_dec_cpuslocked(struct static_key *key) +{ + static_key_slow_dec(key); +} + static inline int jump_label_text_reserved(void *start, void *end) { return 0; diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 8594d24e4adc..934ef0bb6c0d 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -79,7 +79,7 @@ int static_key_count(struct static_key *key) } EXPORT_SYMBOL_GPL(static_key_count); -static void static_key_slow_inc_cpuslocked(struct static_key *key) +void static_key_slow_inc_cpuslocked(struct static_key *key) { int v, v1; @@ -180,9 +180,9 @@ void static_key_disable(struct static_key *key) } EXPORT_SYMBOL_GPL(static_key_disable); -static void static_key_slow_dec_cpuslocked(struct static_key *key, - unsigned long rate_limit, - struct delayed_work *work) +static void __static_key_slow_dec_cpuslocked(struct static_key *key, + unsigned long rate_limit, + struct delayed_work *work) { /* * The negative count check is valid even when a negative @@ -206,12 +206,18 @@ static void static_key_slow_dec_cpuslocked(struct static_key *key, jump_label_unlock(); } +void static_key_slow_dec_cpuslocked(struct static_key *key) +{ + STATIC_KEY_CHECK_USE(key); + __static_key_slow_dec_cpuslocked(key, 0, NULL); +} + static void __static_key_slow_dec(struct static_key *key, unsigned long rate_limit, struct delayed_work *work) { cpus_read_lock(); - static_key_slow_dec_cpuslocked(key, rate_limit, work); + __static_key_slow_dec_cpuslocked(key, rate_limit, work); cpus_read_unlock(); }