Skip to contentSkip to conversation

cgroup: disallow cpuacct if sane_behavior

PATCH New Tejun Heo 1 participant 1 message Jun 6, 2013 cgroup

lore
Share & tools
lore

Tejun Heo

author maintainer
#0 lore raw

PATCH 1/1 cgroup: disallow cpuacct if sane_behavior

cpuacct causes duplicate accountings on the scheduler and cpu will provide equivalent stats. Optimizations for cases where cpu and cpuacct are co-mounted are being worked on but we want to deprecate it eventually. Let's disallow cpuacct if __DEVEL__sane_behavior.

Cc Glauber Costa <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 include/linux/cgroup.h |    3 +++
 kernel/cgroup.c        |    5 +++++
 2 files changed, 8 insertions(+)
include/linux/cgroup.h +3 -0
index d0ad379..6c3bbdb 100644
@@ -280,6 +280,9 @@ enum {
 	 * - memcg: use_hierarchy is on by default and the cgroup file for
 	 *   the flag is not created.
 	 *
+	 * - cpuacct: No longer supported.  cpu will have matching stats.
+	 *   Use those instead.
+	 *
 	 * The followings are planned changes.
 	 *
 	 * - release_agent will be disallowed once replacement notification
kernel/cgroup.c +5 -0
index bc53d50..5c746eb 100644
@@ -1256,6 +1256,11 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
 			pr_err("cgroup: sane_behavior: clone_children is not allowed\n");
 			return -EINVAL;
 		}
+
+		if (test_bit(cpuacct_subsys_id, &opts->subsys_mask)) {
+			pr_err("cgroup: sane_behavior: cpuacct is no longer available, use stats from cpu instead\n");
+			return -EINVAL;
+		}
 	}
 
 	/*