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

Submitted by Kirill Tkhai on Feb. 20, 2018, 3:09 p.m.

Details

Message ID 151913939168.27906.7759665660695227082.stgit@localhost.localdomain
State New
Series "Fix wrong loadavg accounting inside CT"
Headers show

Commit Message

Kirill Tkhai Feb. 20, 2018, 3:09 p.m.
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@virtuozzo.com>
---
 kernel/sched/core.c |    4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

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",