Skip to content

Commit ed11a7f

Browse files
amlutoingomolnar
authored andcommitted
context_tracking: Switch to new static_branch API
This is much less error-prone than the old code. Signed-off-by: Andy 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.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 49b2410 commit ed11a7f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎include/linux/context_tracking_state.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ struct context_tracking {
2222
};
2323

2424
#ifdef CONFIG_CONTEXT_TRACKING
25-
extern struct static_key context_tracking_enabled;
25+
extern struct static_key_false context_tracking_enabled;
2626
DECLARE_PER_CPU(struct context_tracking, context_tracking);
2727

2828
static inline bool context_tracking_is_enabled(void)
2929
{
30-
return static_key_false(&context_tracking_enabled);
30+
return static_branch_unlikely(&context_tracking_enabled);
3131
}
3232

3333
static inline bool context_tracking_cpu_is_enabled(void)

‎kernel/context_tracking.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define CREATE_TRACE_POINTS
2525
#include <trace/events/context_tracking.h>
2626

27-
struct static_key context_tracking_enabled = STATIC_KEY_INIT_FALSE;
27+
DEFINE_STATIC_KEY_FALSE(context_tracking_enabled);
2828
EXPORT_SYMBOL_GPL(context_tracking_enabled);
2929

3030
DEFINE_PER_CPU(struct context_tracking, context_tracking);
@@ -191,7 +191,7 @@ void __init context_tracking_cpu_set(int cpu)
191191

192192
if (!per_cpu(context_tracking.active, cpu)) {
193193
per_cpu(context_tracking.active, cpu) = true;
194-
static_key_slow_inc(&context_tracking_enabled);
194+
static_branch_inc(&context_tracking_enabled);
195195
}
196196

197197
if (initialized)

0 commit comments

Comments
 (0)