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

Kirill Tkhai ktkhai at virtuozzo.com
Tue Feb 20 18:09:51 MSK 2018


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>
---
 kernel/sched/core.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9bfae156e6d5..cc01aff0e6ea 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10175,6 +10175,9 @@ int cpu_cgroup_proc_loadavg(struct cgroup *cgrp, struct cftype *cft,
 	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;
@@ -10325,6 +10328,7 @@ static struct cftype cpu_files[] = {
 	{
 		.name = "proc.loadavg",
 		.read_seq_string = cpu_cgroup_proc_loadavg,
+		.flags = CFTYPE_NOT_ON_ROOT,
 	},
 	{
 		.name = "delayacct.total",



More information about the Devel mailing list