[Devel] [PATCH RHEL COMMIT] ve/sysinfo/loadavg: Virtualize loadavg values in sysinfo()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 1 19:38:44 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 9776203b5ef6cc0f862bb025f32bab6006ca73e5
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Oct 1 19:38:44 2021 +0300

    ve/sysinfo/loadavg: Virtualize loadavg values in sysinfo()
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    (cherry-picked from vz8 commit 422790bdf1a6 ("ve/sysinfo/loadavg:
    Virtualize loadavg values in sysinfo()"))
    
    Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 kernel/sys.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/sys.c b/kernel/sys.c
index 1943af548f59..21eb1ab5dce0 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2589,6 +2589,8 @@ SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep,
 }
 
 extern void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve);
+extern int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
+			  unsigned long offset, int shift);
 
 /**
  * do_sysinfo - fill in sysinfo struct
@@ -2621,6 +2623,10 @@ static int do_sysinfo(struct sysinfo *info)
 			       ve->start_boottime / NSEC_PER_SEC;
 
 		info->procs = nr_threads_ve(ve);
+
+		/* does not fail on non-VE0 task group */
+		(void)get_avenrun_tg(NULL, info->loads,
+				     0, SI_LOAD_SHIFT - FSHIFT);
 	}
 
 	/*


More information about the Devel mailing list