linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Davidlohr Bueso <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, dave@stgolabs.net, peterz@infradead.org,
	dbueso@suse.de, torvalds@linux-foundation.org,
	tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com
Subject: [tip:sched/core] sched/core: Update preempt_notifier_key to modern API
Date: Tue, 27 Mar 2018 00:46:29 -0700	[thread overview]
Message-ID: <tip-b720342849fe685310fca01748a32730a6eca5aa@git.kernel.org> (raw)
In-Reply-To: <20180326210929.5244-4-dave@stgolabs.net>

Commit-ID:  b720342849fe685310fca01748a32730a6eca5aa
Gitweb:     https://git.kernel.org/tip/b720342849fe685310fca01748a32730a6eca5aa
Author:     Davidlohr Bueso <dave@stgolabs.net>
AuthorDate: Mon, 26 Mar 2018 14:09:26 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 27 Mar 2018 07:51:45 +0200

sched/core: Update preempt_notifier_key to modern API

No changes in refcount semantics, use DEFINE_STATIC_KEY_FALSE()
for initialization and replace:

  static_key_slow_inc|dec()   =>   static_branch_inc|dec()
  static_key_false()          =>   static_branch_unlikely()

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akpm@linux-foundation.org
Link: http://lkml.kernel.org/r/20180326210929.5244-4-dave@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b249adbf2a48..de440456f15c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2462,17 +2462,17 @@ void wake_up_new_task(struct task_struct *p)
 
 #ifdef CONFIG_PREEMPT_NOTIFIERS
 
-static struct static_key preempt_notifier_key = STATIC_KEY_INIT_FALSE;
+static DEFINE_STATIC_KEY_FALSE(preempt_notifier_key);
 
 void preempt_notifier_inc(void)
 {
-	static_key_slow_inc(&preempt_notifier_key);
+	static_branch_inc(&preempt_notifier_key);
 }
 EXPORT_SYMBOL_GPL(preempt_notifier_inc);
 
 void preempt_notifier_dec(void)
 {
-	static_key_slow_dec(&preempt_notifier_key);
+	static_branch_dec(&preempt_notifier_key);
 }
 EXPORT_SYMBOL_GPL(preempt_notifier_dec);
 
@@ -2482,7 +2482,7 @@ EXPORT_SYMBOL_GPL(preempt_notifier_dec);
  */
 void preempt_notifier_register(struct preempt_notifier *notifier)
 {
-	if (!static_key_false(&preempt_notifier_key))
+	if (!static_branch_unlikely(&preempt_notifier_key))
 		WARN(1, "registering preempt_notifier while notifiers disabled\n");
 
 	hlist_add_head(&notifier->link, &current->preempt_notifiers);
@@ -2511,7 +2511,7 @@ static void __fire_sched_in_preempt_notifiers(struct task_struct *curr)
 
 static __always_inline void fire_sched_in_preempt_notifiers(struct task_struct *curr)
 {
-	if (static_key_false(&preempt_notifier_key))
+	if (static_branch_unlikely(&preempt_notifier_key))
 		__fire_sched_in_preempt_notifiers(curr);
 }
 
@@ -2529,7 +2529,7 @@ static __always_inline void
 fire_sched_out_preempt_notifiers(struct task_struct *curr,
 				 struct task_struct *next)
 {
-	if (static_key_false(&preempt_notifier_key))
+	if (static_branch_unlikely(&preempt_notifier_key))
 		__fire_sched_out_preempt_notifiers(curr, next);
 }
 

  reply	other threads:[~2018-03-27  7:47 UTC|newest]

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 to modern api 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-bot for Davidlohr Bueso [this message]
2018-03-26 21:09 ` [PATCH 4/6] perf,x86: Update rdpmc_always_available static key " Davidlohr Bueso
2018-03-27  7:47   ` [tip:perf/core] perf/x86: Update rdpmc_always_available static key to the modern API 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=tip-b720342849fe685310fca01748a32730a6eca5aa@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=dave@stgolabs.net \
    --cc=dbueso@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).