[Devel] [PATCH vz9 15/27] sched/ve: Do not show loadavg in child VE cpu cgroups

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Wed Oct 6 11:57:30 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

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

We can calculate/generate file content for root_task_group only,
others will return empty file content.

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

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry picked from vz7 commit e0199c52bdf4 ("sched/ve: Do not show loadavg in
child VE cpu cgroups"))

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 <alexander.mikhalitsyn at virtuozzo.com>

(cherry-picked from vz8 commit c67da07e6bb5 ("sched/ve: Do not show loadavg in
child VE cpu cgroups"))

Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index dad3dbd6acca..0402b26b92b3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10560,6 +10560,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.30.2



More information about the Devel mailing list