Skip to content

Commit f70cd6b

Browse files
committed
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>
1 parent 8cfe986 commit f70cd6b

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

‎include/linux/context_tracking.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ extern void context_tracking_user_exit(void);
1818
static inline void user_enter(void)
1919
{
2020
if (context_tracking_is_enabled())
21-
context_tracking_user_enter();
21+
context_tracking_enter(CONTEXT_USER);
2222

2323
}
2424
static inline void user_exit(void)
2525
{
2626
if (context_tracking_is_enabled())
27-
context_tracking_user_exit();
27+
context_tracking_exit(CONTEXT_USER);
2828
}
2929

3030
static inline enum ctx_state exception_enter(void)

‎kernel/context_tracking.c‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ void context_tracking_enter(enum ctx_state state)
6262
{
6363
unsigned long flags;
6464

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-
7465
/*
7566
* Some contexts may involve an exception occuring in an irq,
7667
* leading to that nesting:
@@ -128,7 +119,7 @@ EXPORT_SYMBOL_GPL(context_tracking_enter);
128119

129120
void context_tracking_user_enter(void)
130121
{
131-
context_tracking_enter(CONTEXT_USER);
122+
user_enter();
132123
}
133124
NOKPROBE_SYMBOL(context_tracking_user_enter);
134125

@@ -148,9 +139,6 @@ void context_tracking_exit(enum ctx_state state)
148139
{
149140
unsigned long flags;
150141

151-
if (!context_tracking_is_enabled())
152-
return;
153-
154142
if (in_interrupt())
155143
return;
156144

@@ -181,7 +169,7 @@ EXPORT_SYMBOL_GPL(context_tracking_exit);
181169

182170
void context_tracking_user_exit(void)
183171
{
184-
context_tracking_exit(CONTEXT_USER);
172+
user_exit();
185173
}
186174
NOKPROBE_SYMBOL(context_tracking_user_exit);
187175

0 commit comments

Comments
 (0)