linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: "Brian Gerst" <brgerst@gmail.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Andy Lutomirski" <luto@kernel.org>
Subject: [PATCH 2/4] context_tracking: Switch to new static_branch API
Date: Fri,  6 Nov 2015 15:12:44 -0800	[thread overview]
Message-ID: <a139cc494b9d03ca53b11d2bb9196d00e569737e.1446849780.git.luto@kernel.org> (raw)
In-Reply-To: <cover.1446849780.git.luto@kernel.org>
In-Reply-To: <cover.1446849780.git.luto@kernel.org>

This is much less error-prone than the old code.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 include/linux/context_tracking_state.h | 4 ++--
 kernel/context_tracking.c              | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index ee956c528fab..1d34fe68f48a 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -22,12 +22,12 @@ struct context_tracking {
 };
 
 #ifdef CONFIG_CONTEXT_TRACKING
-extern struct static_key context_tracking_enabled;
+extern struct static_key_false context_tracking_enabled;
 DECLARE_PER_CPU(struct context_tracking, context_tracking);
 
 static inline bool context_tracking_is_enabled(void)
 {
-	return static_key_false(&context_tracking_enabled);
+	return static_branch_unlikely(&context_tracking_enabled);
 }
 
 static inline bool context_tracking_cpu_is_enabled(void)
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 0a495ab35bc7..d0fb09e40784 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -24,7 +24,7 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/context_tracking.h>
 
-struct static_key context_tracking_enabled = STATIC_KEY_INIT_FALSE;
+DEFINE_STATIC_KEY_FALSE(context_tracking_enabled);
 EXPORT_SYMBOL_GPL(context_tracking_enabled);
 
 DEFINE_PER_CPU(struct context_tracking, context_tracking);
@@ -191,7 +191,7 @@ void __init context_tracking_cpu_set(int cpu)
 
 	if (!per_cpu(context_tracking.active, cpu)) {
 		per_cpu(context_tracking.active, cpu) = true;
-		static_key_slow_inc(&context_tracking_enabled);
+		static_branch_inc(&context_tracking_enabled);
 	}
 
 	if (initialized)
-- 
2.4.3


  parent reply	other threads:[~2015-11-06 23:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 23:12 [PATCH 0/4] x86 entry stuff, maybe for 4.4 Andy Lutomirski
2015-11-06 23:12 ` [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking Andy Lutomirski
2015-11-07  9:59   ` Thomas Gleixner
2015-11-07 11:18   ` Borislav Petkov
2015-11-09  4:20     ` Andy Lutomirski
2015-11-06 23:12 ` Andy Lutomirski [this message]
2015-11-07  9:59   ` [PATCH 2/4] context_tracking: Switch to new static_branch API Thomas Gleixner
2015-11-06 23:12 ` [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski
2015-11-07 11:20   ` Thomas Gleixner
2015-11-07 16:49     ` Andy Lutomirski
2015-11-07 16:58       ` Thomas Gleixner
2015-11-07 17:05         ` Andy Lutomirski
2015-11-07 17:08           ` Thomas Gleixner
2015-11-07 18:16             ` Andy Lutomirski
2015-11-09  9:48               ` Peter Zijlstra
2015-11-08 16:16             ` Andy Lutomirski
2015-11-06 23:12 ` [PATCH 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots Andy Lutomirski
2015-11-09  8:52   ` Ingo Molnar

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=a139cc494b9d03ca53b11d2bb9196d00e569737e.1446849780.git.luto@kernel.org \
    --to=luto@kernel.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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).