aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2013-11-06 08:45:57 -0500
committerFrederic Weisbecker <fweisbec@gmail.com>2013-12-02 14:43:14 -0500
commit58135f574f1b791c926622387780ed3d090116d6 (patch)
treedc6c361777cd0f1bf051dbbddeccb7942400951d /include/linux
parent99c8b1ea0972be82ce1842d830e0173e70907065 (diff)
context_tracking: Wrap static key check into more intuitive function name
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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/context_tracking.h10
-rw-r--r--include/linux/context_tracking_state.h4
-rw-r--r--include/linux/tick.h2
-rw-r--r--include/linux/vtime.h2
4 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 158158704c30..37b81bd51ec0 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -17,13 +17,13 @@ extern void __context_tracking_task_switch(struct task_struct *prev,
17 17
18static inline void user_enter(void) 18static inline void user_enter(void)
19{ 19{
20 if (static_key_false(&context_tracking_enabled)) 20 if (context_tracking_is_enabled())
21 context_tracking_user_enter(); 21 context_tracking_user_enter();
22 22
23} 23}
24static inline void user_exit(void) 24static inline void user_exit(void)
25{ 25{
26 if (static_key_false(&context_tracking_enabled)) 26 if (context_tracking_is_enabled())
27 context_tracking_user_exit(); 27 context_tracking_user_exit();
28} 28}
29 29
@@ -31,7 +31,7 @@ static inline enum ctx_state exception_enter(void)
31{ 31{
32 enum ctx_state prev_ctx; 32 enum ctx_state prev_ctx;
33 33
34 if (!static_key_false(&context_tracking_enabled)) 34 if (!context_tracking_is_enabled())
35 return 0; 35 return 0;
36 36
37 prev_ctx = this_cpu_read(context_tracking.state); 37 prev_ctx = this_cpu_read(context_tracking.state);
@@ -42,7 +42,7 @@ static inline enum ctx_state exception_enter(void)
42 42
43static inline void exception_exit(enum ctx_state prev_ctx) 43static inline void exception_exit(enum ctx_state prev_ctx)
44{ 44{
45 if (static_key_false(&context_tracking_enabled)) { 45 if (context_tracking_is_enabled()) {
46 if (prev_ctx == IN_USER) 46 if (prev_ctx == IN_USER)
47 context_tracking_user_enter(); 47 context_tracking_user_enter();
48 } 48 }
@@ -51,7 +51,7 @@ static inline void exception_exit(enum ctx_state prev_ctx)
51static inline void context_tracking_task_switch(struct task_struct *prev, 51static inline void context_tracking_task_switch(struct task_struct *prev,
52 struct task_struct *next) 52 struct task_struct *next)
53{ 53{
54 if (static_key_false(&context_tracking_enabled)) 54 if (context_tracking_is_enabled())
55 __context_tracking_task_switch(prev, next); 55 __context_tracking_task_switch(prev, next);
56} 56}
57#else 57#else
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 0f1979d0674f..0db535b79be7 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -22,6 +22,10 @@ struct context_tracking {
22extern struct static_key context_tracking_enabled; 22extern struct static_key context_tracking_enabled;
23DECLARE_PER_CPU(struct context_tracking, context_tracking); 23DECLARE_PER_CPU(struct context_tracking, context_tracking);
24 24
25static inline bool context_tracking_is_enabled(void)
26{
27 return static_key_false(&context_tracking_enabled);
28}
25static inline bool context_tracking_in_user(void) 29static inline bool context_tracking_in_user(void)
26{ 30{
27 return __this_cpu_read(context_tracking.state) == IN_USER; 31 return __this_cpu_read(context_tracking.state) == IN_USER;
diff --git a/include/linux/tick.h b/include/linux/tick.h
index a004f66a6cf0..0175d8663b6c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -165,7 +165,7 @@ extern cpumask_var_t tick_nohz_full_mask;
165 165
166static inline bool tick_nohz_full_enabled(void) 166static inline bool tick_nohz_full_enabled(void)
167{ 167{
168 if (!static_key_false(&context_tracking_enabled)) 168 if (!context_tracking_is_enabled())
169 return false; 169 return false;
170 170
171 return tick_nohz_full_running; 171 return tick_nohz_full_running;
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index f5b72b364bda..807c732cbf29 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -19,7 +19,7 @@ static inline bool vtime_accounting_enabled(void) { return true; }
19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
20static inline bool vtime_accounting_enabled(void) 20static inline bool vtime_accounting_enabled(void)
21{ 21{
22 if (static_key_false(&context_tracking_enabled)) { 22 if (context_tracking_is_enabled()) {
23 if (context_tracking_active()) 23 if (context_tracking_active())
24 return true; 24 return true;
25 } 25 }