aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-10-27 21:39:55 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2015-11-10 06:06:22 -0500
commitf70cd6b07e629f367bb9b1ac9d0e3e669eb325c0 (patch)
treed7598a2f03f41b30d8dd415eabcc27f9785bbc58
parent8cfe9866960581303f244780945c5d12ecc4e5bc (diff)
context_tracking: remove duplicate enabled check
All calls to context_tracking_enter and context_tracking_exit are already checking context_tracking_is_enabled, except the context_tracking_user_enter and context_tracking_user_exit functions left in for the benefit of assembly calls. Pull the check up to those functions, by making them simple wrappers around the user_enter and user_exit inline functions. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Paul McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Rik van Riel <riel@redhat.com> Tested-by: Rik van Riel <riel@redhat.com> Acked-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--include/linux/context_tracking.h4
-rw-r--r--kernel/context_tracking.c16
2 files changed, 4 insertions, 16 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 008fc67d0d96..6ef136ff0897 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -18,13 +18,13 @@ extern void context_tracking_user_exit(void);
18static inline void user_enter(void) 18static inline void user_enter(void)
19{ 19{
20 if (context_tracking_is_enabled()) 20 if (context_tracking_is_enabled())
21 context_tracking_user_enter(); 21 context_tracking_enter(CONTEXT_USER);
22 22
23} 23}
24static inline void user_exit(void) 24static inline void user_exit(void)
25{ 25{
26 if (context_tracking_is_enabled()) 26 if (context_tracking_is_enabled())
27 context_tracking_user_exit(); 27 context_tracking_exit(CONTEXT_USER);
28} 28}
29 29
30static inline enum ctx_state exception_enter(void) 30static inline enum ctx_state exception_enter(void)
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 0a495ab35bc7..6d4c6ce21275 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -63,15 +63,6 @@ void context_tracking_enter(enum ctx_state state)
63 unsigned long flags; 63 unsigned long flags;
64 64
65 /* 65 /*
66 * Repeat the user_enter() check here because some archs may be calling
67 * this from asm and if no CPU needs context tracking, they shouldn't
68 * go further. Repeat the check here until they support the inline static
69 * key check.
70 */
71 if (!context_tracking_is_enabled())
72 return;
73
74 /*
75 * Some contexts may involve an exception occuring in an irq, 66 * Some contexts may involve an exception occuring in an irq,
76 * leading to that nesting: 67 * leading to that nesting:
77 * rcu_irq_enter() rcu_user_exit() rcu_user_exit() rcu_irq_exit() 68 * rcu_irq_enter() rcu_user_exit() rcu_user_exit() rcu_irq_exit()
@@ -128,7 +119,7 @@ EXPORT_SYMBOL_GPL(context_tracking_enter);
128 119
129void context_tracking_user_enter(void) 120void context_tracking_user_enter(void)
130{ 121{
131 context_tracking_enter(CONTEXT_USER); 122 user_enter();
132} 123}
133NOKPROBE_SYMBOL(context_tracking_user_enter); 124NOKPROBE_SYMBOL(context_tracking_user_enter);
134 125
@@ -148,9 +139,6 @@ void context_tracking_exit(enum ctx_state state)
148{ 139{
149 unsigned long flags; 140 unsigned long flags;
150 141
151 if (!context_tracking_is_enabled())
152 return;
153
154 if (in_interrupt()) 142 if (in_interrupt())
155 return; 143 return;
156 144
@@ -181,7 +169,7 @@ EXPORT_SYMBOL_GPL(context_tracking_exit);
181 169
182void context_tracking_user_exit(void) 170void context_tracking_user_exit(void)
183{ 171{
184 context_tracking_exit(CONTEXT_USER); 172 user_exit();
185} 173}
186NOKPROBE_SYMBOL(context_tracking_user_exit); 174NOKPROBE_SYMBOL(context_tracking_user_exit);
187 175