* [PATCH] context_tracking: remove duplicate enabled check
@ 2015-04-28 11:36 Paolo Bonzini
2015-04-28 12:50 ` Rik van Riel
2015-04-28 20:04 ` Rik van Riel
0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-04-28 11:36 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: fweisbec, riel, paulmck
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.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/linux/context_tracking.h | 4 ++--
kernel/context_tracking.c | 16 ++--------------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 2821838256b4..a20a2badbc5f 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -20,13 +20,13 @@ extern void __context_tracking_task_switch(struct task_struct *prev,
static inline void user_enter(void)
{
if (context_tracking_is_enabled())
- context_tracking_user_enter();
+ context_tracking_enter(CONTEXT_USER);
}
static inline void user_exit(void)
{
if (context_tracking_is_enabled())
- context_tracking_user_exit();
+ context_tracking_exit(CONTEXT_USER);
}
static inline enum ctx_state exception_enter(void)
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 72d59a1a6eb6..ccdc188884d7 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -52,15 +52,6 @@ void context_tracking_enter(enum ctx_state state)
unsigned long flags;
/*
- * 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 inline static
- * key check.
- */
- if (!context_tracking_is_enabled())
- return;
-
- /*
* Some contexts may involve an exception occuring in an irq,
* leading to that nesting:
* rcu_irq_enter() rcu_user_exit() rcu_user_exit() rcu_irq_exit()
@@ -112,7 +103,7 @@ EXPORT_SYMBOL_GPL(context_tracking_enter);
void context_tracking_user_enter(void)
{
- context_tracking_enter(CONTEXT_USER);
+ user_enter();
}
NOKPROBE_SYMBOL(context_tracking_user_enter);
@@ -132,9 +123,6 @@ void context_tracking_exit(enum ctx_state state)
{
unsigned long flags;
- if (!context_tracking_is_enabled())
- return;
-
if (in_interrupt())
return;
@@ -160,7 +148,7 @@ EXPORT_SYMBOL_GPL(context_tracking_exit);
void context_tracking_user_exit(void)
{
- context_tracking_exit(CONTEXT_USER);
+ user_exit();
}
NOKPROBE_SYMBOL(context_tracking_user_exit);
--
2.3.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] context_tracking: remove duplicate enabled check
2015-04-28 11:36 [PATCH] context_tracking: remove duplicate enabled check Paolo Bonzini
@ 2015-04-28 12:50 ` Rik van Riel
2015-04-28 20:04 ` Rik van Riel
1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2015-04-28 12:50 UTC (permalink / raw)
To: Paolo Bonzini, linux-kernel, kvm; +Cc: fweisbec, paulmck
On 04/28/2015 07:36 AM, Paolo Bonzini wrote:
> 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.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
--
All rights reversed
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] context_tracking: remove duplicate enabled check
2015-04-28 11:36 [PATCH] context_tracking: remove duplicate enabled check Paolo Bonzini
2015-04-28 12:50 ` Rik van Riel
@ 2015-04-28 20:04 ` Rik van Riel
1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2015-04-28 20:04 UTC (permalink / raw)
To: Paolo Bonzini, linux-kernel, kvm; +Cc: fweisbec, paulmck
On 04/28/2015 07:36 AM, Paolo Bonzini wrote:
> 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.
With this and your other (not yet posted) patch, run time
for the kvm-unit-tests vmexit.flat vmcall test with 10
million iterations drops from 17.8 to 17.5 seconds, which
is about a 1.7% speedup.
--
All rights reversed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-28 20:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 11:36 [PATCH] context_tracking: remove duplicate enabled check Paolo Bonzini
2015-04-28 12:50 ` Rik van Riel
2015-04-28 20:04 ` Rik van Riel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.