]> git.karo-electronics.de Git - linux-beck.git/commitdiff
context_tracking: Wrap static key check into more intuitive function name
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 6 Nov 2013 13:45:57 +0000 (14:45 +0100)
committerFrederic Weisbecker <fweisbec@gmail.com>
Mon, 2 Dec 2013 19:43:14 +0000 (20:43 +0100)
Use a function with a meaningful name to check the global context
tracking state. static_key_false() is a bit confusing for reviewers.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
include/linux/context_tracking.h
include/linux/context_tracking_state.h
include/linux/tick.h
include/linux/vtime.h
kernel/context_tracking.c

index 158158704c30e75820913051283c6533ce669a4b..37b81bd51ec0e48ce7ec9c24608aeca3ca92ad36 100644 (file)
@@ -17,13 +17,13 @@ extern void __context_tracking_task_switch(struct task_struct *prev,
 
 static inline void user_enter(void)
 {
-       if (static_key_false(&context_tracking_enabled))
+       if (context_tracking_is_enabled())
                context_tracking_user_enter();
 
 }
 static inline void user_exit(void)
 {
-       if (static_key_false(&context_tracking_enabled))
+       if (context_tracking_is_enabled())
                context_tracking_user_exit();
 }
 
@@ -31,7 +31,7 @@ static inline enum ctx_state exception_enter(void)
 {
        enum ctx_state prev_ctx;
 
-       if (!static_key_false(&context_tracking_enabled))
+       if (!context_tracking_is_enabled())
                return 0;
 
        prev_ctx = this_cpu_read(context_tracking.state);
@@ -42,7 +42,7 @@ static inline enum ctx_state exception_enter(void)
 
 static inline void exception_exit(enum ctx_state prev_ctx)
 {
-       if (static_key_false(&context_tracking_enabled)) {
+       if (context_tracking_is_enabled()) {
                if (prev_ctx == IN_USER)
                        context_tracking_user_enter();
        }
@@ -51,7 +51,7 @@ static inline void exception_exit(enum ctx_state prev_ctx)
 static inline void context_tracking_task_switch(struct task_struct *prev,
                                                struct task_struct *next)
 {
-       if (static_key_false(&context_tracking_enabled))
+       if (context_tracking_is_enabled())
                __context_tracking_task_switch(prev, next);
 }
 #else
index 0f1979d0674f86e5ab006b9a0639fe9436a9e4bb..0db535b79be737169e2c7d94bfdc4f38d8decdc0 100644 (file)
@@ -22,6 +22,10 @@ struct context_tracking {
 extern struct static_key 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);
+}
 static inline bool context_tracking_in_user(void)
 {
        return __this_cpu_read(context_tracking.state) == IN_USER;
index a004f66a6cf0fcb0a2a2a90270b0baa1dad526f7..0175d8663b6cbd9cb259b5715436fbd09e0ce213 100644 (file)
@@ -165,7 +165,7 @@ extern cpumask_var_t tick_nohz_full_mask;
 
 static inline bool tick_nohz_full_enabled(void)
 {
-       if (!static_key_false(&context_tracking_enabled))
+       if (!context_tracking_is_enabled())
                return false;
 
        return tick_nohz_full_running;
index f5b72b364bda4c6437903d4669b65b5aad0e017a..807c732cbf29e396260e1802762e397fc7936000 100644 (file)
@@ -19,7 +19,7 @@ static inline bool vtime_accounting_enabled(void) { return true; }
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
 static inline bool vtime_accounting_enabled(void)
 {
-       if (static_key_false(&context_tracking_enabled)) {
+       if (context_tracking_is_enabled()) {
                if (context_tracking_active())
                        return true;
        }
index e5f3917aa05b724f3367e4fad474534eb34138c5..6cb20d2e7ee0d28b0d6399a8cd1f3e23f9366899 100644 (file)
@@ -53,10 +53,10 @@ void context_tracking_user_enter(void)
        /*
         * Repeat the user_enter() check here because some archs may be calling
         * this from asm and if no CPU needs context tracking, they shouldn't
-        * go further. Repeat the check here until they support the static key
-        * check.
+        * go further. Repeat the check here until they support the inline static
+        * key check.
         */
-       if (!static_key_false(&context_tracking_enabled))
+       if (!context_tracking_is_enabled())
                return;
 
        /*
@@ -160,7 +160,7 @@ void context_tracking_user_exit(void)
 {
        unsigned long flags;
 
-       if (!static_key_false(&context_tracking_enabled))
+       if (!context_tracking_is_enabled())
                return;
 
        if (in_interrupt())