[tip: sched/core] context_tracking: Introduce context_tracking_enabled_cpu()
From: tip-bot2 for Frederic Weisbecker
Date: Tue Oct 29 2019 - 05:52:42 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 097f2541c6e51e0c1cdb1e6d46ef08a624336518
Gitweb: https://git.kernel.org/tip/097f2541c6e51e0c1cdb1e6d46ef08a624336518
Author: Frederic Weisbecker <frederic@xxxxxxxxxx>
AuthorDate: Wed, 16 Oct 2019 04:56:53 +02:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Tue, 29 Oct 2019 10:01:13 +01:00
context_tracking: Introduce context_tracking_enabled_cpu()
This allows us to check if a remote CPU runs context tracking
(ie: is nohz_full). We'll need that to reliably support "nice"
accounting on kcpustat.
Signed-off-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: Jacek Anaszewski <jacek.anaszewski@xxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Pavel Machek <pavel@xxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Rafael J . Wysocki <rjw@xxxxxxxxxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Cc: Wanpeng Li <wanpengli@xxxxxxxxxxx>
Cc: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxxx>
Link: https://lkml.kernel.org/r/20191016025700.31277-8-frederic@xxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
include/linux/context_tracking_state.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 08f125f..5877177 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -31,6 +31,11 @@ static inline bool context_tracking_enabled(void)
return static_branch_unlikely(&context_tracking_key);
}
+static inline bool context_tracking_enabled_cpu(int cpu)
+{
+ return per_cpu(context_tracking.active, cpu);
+}
+
static inline bool context_tracking_enabled_this_cpu(void)
{
return __this_cpu_read(context_tracking.active);
@@ -43,6 +48,7 @@ static inline bool context_tracking_in_user(void)
#else
static inline bool context_tracking_in_user(void) { return false; }
static inline bool context_tracking_enabled(void) { return false; }
+static inline bool context_tracking_enabled_cpu(int cpu) { return false; }
static inline bool context_tracking_enabled_this_cpu(void) { return false; }
#endif /* CONFIG_CONTEXT_TRACKING */