mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
context_tracking: Check static key on context_tracking_enabled_*cpu()
guest_enter() doesn't call context_tracking_enabled() before calling context_tracking_enabled_this_cpu(). Therefore the guest code doesn't benefit from the static key on the fast path. Just make sure that context_tracking_enabled_*cpu() functions check the static key by themselves to propagate the optimization. Reported-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: Rafael J . Wysocki <rjw@rjwysocki.net> Cc: Rik van Riel <riel@surriel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Wanpeng Li <wanpengli@tencent.com> Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com> Link: https://lkml.kernel.org/r/20191016025700.31277-11-frederic@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
9adbb9dd4c
commit
023e9deb51
@ -33,12 +33,12 @@ static inline bool context_tracking_enabled(void)
|
||||
|
||||
static inline bool context_tracking_enabled_cpu(int cpu)
|
||||
{
|
||||
return per_cpu(context_tracking.active, cpu);
|
||||
return context_tracking_enabled() && per_cpu(context_tracking.active, cpu);
|
||||
}
|
||||
|
||||
static inline bool context_tracking_enabled_this_cpu(void)
|
||||
{
|
||||
return __this_cpu_read(context_tracking.active);
|
||||
return context_tracking_enabled() && __this_cpu_read(context_tracking.active);
|
||||
}
|
||||
|
||||
static inline bool context_tracking_in_user(void)
|
||||
|
@ -33,12 +33,12 @@ static inline bool vtime_accounting_enabled(void)
|
||||
|
||||
static inline bool vtime_accounting_enabled_cpu(int cpu)
|
||||
{
|
||||
return (vtime_accounting_enabled() && context_tracking_enabled_cpu(cpu));
|
||||
return context_tracking_enabled_cpu(cpu);
|
||||
}
|
||||
|
||||
static inline bool vtime_accounting_enabled_this_cpu(void)
|
||||
{
|
||||
return (vtime_accounting_enabled() && context_tracking_enabled_this_cpu());
|
||||
return context_tracking_enabled_this_cpu();
|
||||
}
|
||||
|
||||
extern void vtime_task_switch_generic(struct task_struct *prev);
|
||||
|
Loading…
Reference in New Issue
Block a user