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

Alexander Mikhalitsyn alexander.mikhalitsyn at virtuozzo.com
Fri May 21 18:56:13 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 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 <ktkhai at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
(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 <alexander.mikhalitsyn 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 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



More information about the Devel mailing list