[rh8,2/5] sched: Account task_group::start_time

Submitted by Konstantin Khorenko on Oct. 8, 2020, 3:22 p.m.

Details

Message ID 20201008152203.1173132-3-khorenko@virtuozzo.com
State New
Series "ve/time: first patchset for times virtualization in CT"
Headers show

Commit Message

Konstantin Khorenko Oct. 8, 2020, 3:22 p.m.
From: Kirill Tkhai <ktkhai@virtuozzo.com>

Extracted from "Initial patch".

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>

(cherry picked from vz7 commit bad04073f185d257f6a3290523ca02c095837e8b)
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>

Rebase to vz8 notes:
* moved from struct timespec to u64 (nsec)
---
 kernel/sched/core.c  | 4 ++++
 kernel/sched/sched.h | 3 +++
 2 files changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 92062773e632..8a57956d64d6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6095,6 +6095,7 @@  void __init sched_init(void)
 #ifdef CONFIG_CFS_CPULIMIT
 	root_task_group.topmost_limited_ancestor = &root_task_group;
 #endif
+	root_task_group.start_time = 0;
 #endif /* CONFIG_CGROUP_SCHED */
 
 	for_each_possible_cpu(i) {
@@ -6413,6 +6414,9 @@  struct task_group *sched_create_group(struct task_group *parent)
 	if (!alloc_rt_sched_group(tg, parent))
 		goto err;
 
+	/* start_timespec is saved CT0 uptime */
+	tg->start_time = ktime_get_boot_ns();
+
 	return tg;
 
 err:
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 4dbf03a3242f..b2f0c26b2c50 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -404,6 +404,9 @@  struct task_group {
 	struct autogroup	*autogroup;
 #endif
 
+	/* Monotonic time in nsecs: */
+	u64			start_time;
+
 	struct cfs_bandwidth	cfs_bandwidth;
 #ifdef CONFIG_CFS_CPULIMIT
 #define MAX_CPU_RATE 1024