[Devel] [PATCH vz9 15/23] ve/sysinfo/loadavg: Virtualize loadavg values in sysinfo()

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Fri Oct 1 18:53:23 MSK 2021


From: Konstantin Khorenko <khorenko at virtuozzo.com>

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);
 	}
 
 	/*
-- 
2.30.2



More information about the Devel mailing list