[Devel] [PATCH rh7] num_cgroups in /proc/cgroups output

Vasily Averin vvs at odin.com
Thu May 14 06:17:23 PDT 2015


like in rh6-based kernels,
/proc/cgroups output inside container shows 1 in 'num_cgroups' column

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

Signed-off-by: Vasily Averin <vvs at openvz.org>
-------------- next part --------------
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f881f69..f897042 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4815,6 +4815,8 @@ out:
 	return retval;
 }
 
+#define _cg_virtualized(x) ((ve_is_super(get_exec_env())) ? (x) : 1)
+
 /* Display information about each subsystem and each hierarchy */
 static int proc_cgroupstats_show(struct seq_file *m, void *v)
 {
@@ -4829,11 +4831,14 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)
 	mutex_lock(&cgroup_mutex);
 	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
 		struct cgroup_subsys *ss = subsys[i];
+		int num;
+
 		if (ss == NULL)
 			continue;
+		num = _cg_virtualized(ss->root->number_of_cgroups);
 		seq_printf(m, "%s\t%d\t%d\t%d\n",
 			   ss->name, ss->root->hierarchy_id,
-			   ss->root->number_of_cgroups, !ss->disabled);
+			   num, !ss->disabled);
 	}
 	mutex_unlock(&cgroup_mutex);
 	return 0;


More information about the Devel mailing list