mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 05:02:12 +00:00
context_tracking: Optimize context switch off case with static keys
No need for syscall slowpath if no CPU is full dynticks, rather nop this in this case. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Kevin Hilman <khilman@linaro.org>
This commit is contained in:
parent
48d6a816a8
commit
73d424f9af
@ -40,6 +40,8 @@ extern void context_tracking_cpu_set(int cpu);
|
||||
|
||||
extern void context_tracking_user_enter(void);
|
||||
extern void context_tracking_user_exit(void);
|
||||
extern void __context_tracking_task_switch(struct task_struct *prev,
|
||||
struct task_struct *next);
|
||||
|
||||
static inline void user_enter(void)
|
||||
{
|
||||
@ -74,8 +76,12 @@ static inline void exception_exit(enum ctx_state prev_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
extern void context_tracking_task_switch(struct task_struct *prev,
|
||||
struct task_struct *next);
|
||||
static inline void context_tracking_task_switch(struct task_struct *prev,
|
||||
struct task_struct *next)
|
||||
{
|
||||
if (static_key_false(&context_tracking_enabled))
|
||||
__context_tracking_task_switch(prev, next);
|
||||
}
|
||||
#else
|
||||
static inline bool context_tracking_in_user(void) { return false; }
|
||||
static inline void user_enter(void) { }
|
||||
@ -112,6 +118,7 @@ static inline void guest_exit(void)
|
||||
else
|
||||
current->flags &= ~PF_VCPU;
|
||||
}
|
||||
|
||||
#else
|
||||
static inline void guest_enter(void)
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ void context_tracking_user_exit(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* context_tracking_task_switch - context switch the syscall callbacks
|
||||
* __context_tracking_task_switch - context switch the syscall callbacks
|
||||
* @prev: the task that is being switched out
|
||||
* @next: the task that is being switched in
|
||||
*
|
||||
@ -178,8 +178,8 @@ void context_tracking_user_exit(void)
|
||||
* migrate to some CPU that doesn't do the context tracking. As such the TIF
|
||||
* flag may not be desired there.
|
||||
*/
|
||||
void context_tracking_task_switch(struct task_struct *prev,
|
||||
struct task_struct *next)
|
||||
void __context_tracking_task_switch(struct task_struct *prev,
|
||||
struct task_struct *next)
|
||||
{
|
||||
clear_tsk_thread_flag(prev, TIF_NOHZ);
|
||||
set_tsk_thread_flag(next, TIF_NOHZ);
|
||||
|
Loading…
Reference in New Issue
Block a user