[Devel] [PATCH RHEL7 COMMIT] sched/ve: Fix sysinfo syscall inside Containers

Konstantin Khorenko khorenko at virtuozzo.com
Wed Dec 7 20:52:44 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.80.1.vz7.191.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.80.1.vz7.191.1
------>
commit b4013b3b36968232d163d7e4c49bc2fcf18ed1a3
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Fri Dec 2 14:46:53 2022 +0200

    sched/ve: Fix sysinfo syscall inside Containers
    
    Use the already available function to get the calculated
    load average for the Container and return correct values to userspace.
    
    https://bugs.openvz.org/browse/OVZ-7377
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 kernel/sched/core.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3b3ed03d858f..307c3dc9e5e7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2908,10 +2908,14 @@ void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
 
 void get_avenrun_ve(unsigned long *loads, unsigned long offset, int shift)
 {
-	struct task_group *tg = task_group(current);
-	loads[0] = (tg->avenrun[0] + offset) << shift;
-	loads[1] = (tg->avenrun[1] + offset) << shift;
-	loads[2] = (tg->avenrun[2] + offset) << shift;
+	struct ve_struct *ve = get_exec_env();
+
+	if (ve_get_cpu_avenrun(ve, loads))
+		return;
+
+	loads[0] = (loads[0] + offset) << shift;
+	loads[1] = (loads[1] + offset) << shift;
+	loads[2] = (loads[2] + offset) << shift;
 }
 
 static long calc_load_fold_active(struct rq *this_rq)


More information about the Devel mailing list