lkml.org 
[lkml]   [2019]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 09/14] sched/vtime: Introduce vtime_accounting_enabled_cpu()
Date
This allows us to check if a remote CPU runs vtime accounting
(ie: is nohz_full). We'll need that to reliably support reading kcpustat
on nohz_full CPUs.

Also simplify a bit the condition in the local flavoured function while
at it.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Rik van Riel <riel@surriel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <wanpengli@tencent.com>
Cc: Ingo Molnar <mingo@kernel.org>
---
include/linux/vtime.h | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index eb2e7a19054b..e2733bf33541 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -31,14 +31,14 @@ static inline bool vtime_accounting_enabled(void)
return context_tracking_enabled();
}

+static inline bool vtime_accounting_enabled_cpu(int cpu)
+{
+ return (vtime_accounting_enabled() && context_tracking_enabled_cpu(cpu));
+}
+
static inline bool vtime_accounting_enabled_this_cpu(void)
{
- if (vtime_accounting_enabled()) {
- if (context_tracking_enabled_this_cpu())
- return true;
- }
-
- return false;
+ return (vtime_accounting_enabled() && context_tracking_enabled_this_cpu());
}

extern void vtime_task_switch_generic(struct task_struct *prev);
@@ -51,6 +51,7 @@ static inline void vtime_task_switch(struct task_struct *prev)

#else /* !CONFIG_VIRT_CPU_ACCOUNTING */

+static inline bool vtime_accounting_enabled_cpu(int cpu) {return false; }
static inline bool vtime_accounting_enabled_this_cpu(void) { return false; }
static inline void vtime_task_switch(struct task_struct *prev) { }

--
2.23.0
\
 
 \ /
  Last update: 2019-10-16 04:58    [W:0.655 / U:1.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site