From: Davidlohr Bueso <dave@stgolabs.net> To: peterz@infradead.org, mingo@kernel.org, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>, Davidlohr Bueso <dbueso@suse.de> Subject: [PATCH 4/6] perf,x86: Update rdpmc_always_available static key to modern api Date: Mon, 26 Mar 2018 14:09:27 -0700 Message-ID: <20180326210929.5244-5-dave@stgolabs.net> (raw) In-Reply-To: <20180326210929.5244-1-dave@stgolabs.net> No changes in refcount semantics -- key init is false; replace static_key_slow_inc|dec with static_branch_inc|dec static_key_false with static_branch_unlikely Added a '_key' suffix to rdpmc_always_available, for better self documentation. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> --- arch/x86/events/core.c | 6 +++--- arch/x86/include/asm/mmu_context.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index c5f3d83c04ad..7a987e6c7c35 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -48,7 +48,7 @@ DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; -struct static_key rdpmc_always_available = STATIC_KEY_INIT_FALSE; +DEFINE_STATIC_KEY_FALSE(rdpmc_always_available_key); u64 __read_mostly hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX] @@ -2206,9 +2206,9 @@ static ssize_t set_attr_rdpmc(struct device *cdev, * but only root can trigger it, so it's okay. */ if (val == 2) - static_key_slow_inc(&rdpmc_always_available); + static_branch_inc(&rdpmc_always_available_key); else - static_key_slow_dec(&rdpmc_always_available); + static_branch_dec(&rdpmc_always_available_key); on_each_cpu(refresh_pce, NULL, 1); } diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 1de72ce514cd..57e3785d0d26 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -24,11 +24,12 @@ static inline void paravirt_activate_mm(struct mm_struct *prev, #endif /* !CONFIG_PARAVIRT */ #ifdef CONFIG_PERF_EVENTS -extern struct static_key rdpmc_always_available; + +DECLARE_STATIC_KEY_FALSE(rdpmc_always_available_key); static inline void load_mm_cr4(struct mm_struct *mm) { - if (static_key_false(&rdpmc_always_available) || + if (static_branch_unlikely(&rdpmc_always_available_key) || atomic_read(&mm->context.perf_rdpmc_allowed)) cr4_set_bits(X86_CR4_PCE); else -- 2.13.6
next prev parent reply index Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-26 21:09 [PATCH v2 -next 0/6] update static key users " Davidlohr Bueso 2018-03-26 21:09 ` [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key " Davidlohr Bueso 2018-04-03 13:20 ` Wolfram Sang 2018-04-03 14:00 ` David Howells 2018-04-03 14:49 ` Wolfram Sang 2018-03-26 21:09 ` [PATCH 2/6] drivers/irqchip: Update supports_deactivate " Davidlohr Bueso 2018-03-28 13:47 ` Marc Zyngier 2018-03-28 13:46 ` Davidlohr Bueso 2018-03-26 21:09 ` [PATCH 3/6] sched/core: Update preempt_notifier_key " Davidlohr Bueso 2018-03-27 7:46 ` [tip:sched/core] sched/core: Update preempt_notifier_key to modern API tip-bot for Davidlohr Bueso 2018-03-26 21:09 ` Davidlohr Bueso [this message] 2018-03-27 7:47 ` [tip:perf/core] perf/x86: Update rdpmc_always_available static key to the " tip-bot for Davidlohr Bueso 2018-03-26 21:09 ` [PATCH 5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api Davidlohr Bueso 2018-03-27 15:44 ` David Miller 2018-03-27 15:37 ` Davidlohr Bueso 2018-03-26 21:09 ` [PATCH 6/6] net/sock: Update memalloc_socks " Davidlohr Bueso 2018-03-27 7:36 ` [PATCH v2 -next 0/6] update static key users " Peter Zijlstra
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=20180326210929.5244-5-dave@stgolabs.net \ --to=dave@stgolabs.net \ --cc=akpm@linux-foundation.org \ --cc=dbueso@suse.de \ --cc=linux-kernel@vger.kernel.org \ --cc=mingo@kernel.org \ --cc=peterz@infradead.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
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git