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.atana...@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 f5c2545abef5..e20211bdc237 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2917,10 +2917,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)
-- 
2.31.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to