Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+4 -16
+2 -2
include/linux/context_tracking.h
··· 18 18 static inline void user_enter(void) 19 19 { 20 20 if (context_tracking_is_enabled()) 21 - context_tracking_user_enter(); 21 + context_tracking_enter(CONTEXT_USER); 22 22 23 23 } 24 24 static inline void user_exit(void) 25 25 { 26 26 if (context_tracking_is_enabled()) 27 - context_tracking_user_exit(); 27 + context_tracking_exit(CONTEXT_USER); 28 28 } 29 29 30 30 static inline enum ctx_state exception_enter(void)
+2 -14
kernel/context_tracking.c
··· 63 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 66 * Some contexts may involve an exception occuring in an irq, 76 67 * leading to that nesting: 77 68 * rcu_irq_enter() rcu_user_exit() rcu_user_exit() rcu_irq_exit() ··· 119 128 120 129 void context_tracking_user_enter(void) 121 130 { 122 - context_tracking_enter(CONTEXT_USER); 131 + user_enter(); 123 132 } 124 133 NOKPROBE_SYMBOL(context_tracking_user_enter); 125 134 ··· 138 147 void context_tracking_exit(enum ctx_state state) 139 148 { 140 149 unsigned long flags; 141 - 142 - if (!context_tracking_is_enabled()) 143 - return; 144 150 145 151 if (in_interrupt()) 146 152 return; ··· 169 181 170 182 void context_tracking_user_exit(void) 171 183 { 172 - context_tracking_exit(CONTEXT_USER); 184 + user_exit(); 173 185 } 174 186 NOKPROBE_SYMBOL(context_tracking_user_exit); 175 187