Skip to content

Commit

Permalink
context_tracking: Switch to new static_branch API
Browse files Browse the repository at this point in the history
This is much less error-prone than the old code.

Signed-off-by: Andy Lutomirski <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/812df7e64f120c5c7c08481f36a8caa9f53b2199.1447361906.git.luto@kernel.org
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
amluto authored and Ingo Molnar committed Nov 24, 2015
1 parent 49b2410 commit ed11a7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/linux/context_tracking_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions kernel/context_tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ed11a7f

Please sign in to comment.