[Devel] [PATCH RHEL8 COMMIT] sched: Account task_group::start_time

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 14 15:49:25 MSK 2020


The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.12
------>
commit 52becf1c4e0370bec3a93df03c0b5b920e6fa5e8
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Nov 28 16:13:48 2017 +0300

    sched: Account task_group::start_time
    
    Extracted from "Initial patch".
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    (cherry picked from vz7 commit bad04073f185d257f6a3290523ca02c095837e8b)
    Signed-off-by: Konstantin Khorenko <khorenko at 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(+)

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


More information about the Devel mailing list