[RHEL7,COMMIT] sched/ve: Do not show loadavg in child VE cpu cgroups

Submitted by Konstantin Khorenko on Feb. 27, 2018, 12:28 p.m.

Details

Message ID 201802271228.w1RCSTDZ014618@finist_ce7.work
State New
Series "Fix wrong loadavg accounting inside CT"
Headers show

Commit Message

Konstantin Khorenko Feb. 27, 2018, 12:28 p.m.
The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.45.4
------>
commit e0199c52bdf40d8856ec8ff2ae664cbafee872fb
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Tue Feb 27 15:28:29 2018 +0300

    sched/ve: Do not show loadavg in child VE cpu cgroups
    
    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>
    Reviewed-by: Andrey Ryabinin <aryabinin@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",