提交 ed11a7f1 编写于 作者: A Andy Lutomirski 提交者: Ingo Molnar

context_tracking: Switch to new static_branch API

This is much less error-prone than the old code.
Signed-off-by: NAndy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/812df7e64f120c5c7c08481f36a8caa9f53b2199.1447361906.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 49b24106
...@@ -22,12 +22,12 @@ struct context_tracking { ...@@ -22,12 +22,12 @@ struct context_tracking {
}; };
#ifdef CONFIG_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); DECLARE_PER_CPU(struct context_tracking, context_tracking);
static inline bool context_tracking_is_enabled(void) 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) static inline bool context_tracking_cpu_is_enabled(void)
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/context_tracking.h> #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); EXPORT_SYMBOL_GPL(context_tracking_enabled);
DEFINE_PER_CPU(struct context_tracking, context_tracking); DEFINE_PER_CPU(struct context_tracking, context_tracking);
...@@ -191,7 +191,7 @@ void __init context_tracking_cpu_set(int cpu) ...@@ -191,7 +191,7 @@ void __init context_tracking_cpu_set(int cpu)
if (!per_cpu(context_tracking.active, cpu)) { if (!per_cpu(context_tracking.active, cpu)) {
per_cpu(context_tracking.active, cpu) = true; per_cpu(context_tracking.active, cpu) = true;
static_key_slow_inc(&context_tracking_enabled); static_branch_inc(&context_tracking_enabled);
} }
if (initialized) if (initialized)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册