From: Kirill Tkhai <[email protected]>

CT's loadavg is analogy of node's loadavg, and we shouldn't
introduce it for child cpu cgroups.

We can remove the file completely only for root_task_group,
other will return empty file content.

https://jira.sw.ru/browse/PSBM-81572

Signed-off-by: Kirill Tkhai <[email protected]>
Reviewed-by: Andrey Ryabinin <[email protected]>
(cherry picked from commit e0199c52bdf40d8856ec8ff2ae664cbafee872fb)

See also
f49dfc054 ("vecalls: Introduce VZCTL_GET_CPU_STAT ioctl")
b72dd2c52 ("sched: Export per task_group statistics_work")

VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127797

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3878a91a54b5..c2880cf6cf60 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7366,6 +7366,9 @@ int cpu_cgroup_proc_loadavg(struct cgroup_subsys_state 
*css,
        int nr_running = 0;
        int i;
 
+       if (!test_bit(CGRP_VE_ROOT, &cgrp->flags))
+               return 0;
+
        avnrun[0] = tg->avenrun[0] + FIXED_1/200;
        avnrun[1] = tg->avenrun[1] + FIXED_1/200;
        avnrun[2] = tg->avenrun[2] + FIXED_1/200;
-- 
2.28.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to