diff options
author | Waiman Long <longman@redhat.com> | 2017-08-17 15:33:09 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2017-08-18 11:24:21 -0400 |
commit | e1cba4b85daa71b710384d451ff6238d5e4d1ff6 (patch) | |
tree | d3d9847b654a3b4ae59e57fcbd9c81c2df533c23 | |
parent | 696b98f244f77a79840bf420861c996d61c82637 (diff) |
cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup
A new mount option "cpuset_v2_mode" is added to the v1 cgroupfs
filesystem to enable cpuset controller to use v2 behavior in a v1
cgroup. This mount option applies only to cpuset controller and have
no effect on other controllers.
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | include/linux/cgroup-defs.h | 5 | ||||
-rw-r--r-- | kernel/cgroup/cgroup-v1.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 59e4ad9e7bac..ade4a78a54c2 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h | |||
@@ -74,6 +74,11 @@ enum { | |||
74 | * aren't writeable from inside the namespace. | 74 | * aren't writeable from inside the namespace. |
75 | */ | 75 | */ |
76 | CGRP_ROOT_NS_DELEGATE = (1 << 3), | 76 | CGRP_ROOT_NS_DELEGATE = (1 << 3), |
77 | |||
78 | /* | ||
79 | * Enable cpuset controller in v1 cgroup to use v2 behavior. | ||
80 | */ | ||
81 | CGRP_ROOT_CPUSET_V2_MODE = (1 << 4), | ||
77 | }; | 82 | }; |
78 | 83 | ||
79 | /* cftype->flags */ | 84 | /* cftype->flags */ |
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index f0e8601b13cb..024085daab1a 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c | |||
@@ -895,6 +895,8 @@ static int cgroup1_show_options(struct seq_file *seq, struct kernfs_root *kf_roo | |||
895 | seq_puts(seq, ",noprefix"); | 895 | seq_puts(seq, ",noprefix"); |
896 | if (root->flags & CGRP_ROOT_XATTR) | 896 | if (root->flags & CGRP_ROOT_XATTR) |
897 | seq_puts(seq, ",xattr"); | 897 | seq_puts(seq, ",xattr"); |
898 | if (root->flags & CGRP_ROOT_CPUSET_V2_MODE) | ||
899 | seq_puts(seq, ",cpuset_v2_mode"); | ||
898 | 900 | ||
899 | spin_lock(&release_agent_path_lock); | 901 | spin_lock(&release_agent_path_lock); |
900 | if (strlen(root->release_agent_path)) | 902 | if (strlen(root->release_agent_path)) |
@@ -949,6 +951,10 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) | |||
949 | opts->cpuset_clone_children = true; | 951 | opts->cpuset_clone_children = true; |
950 | continue; | 952 | continue; |
951 | } | 953 | } |
954 | if (!strcmp(token, "cpuset_v2_mode")) { | ||
955 | opts->flags |= CGRP_ROOT_CPUSET_V2_MODE; | ||
956 | continue; | ||
957 | } | ||
952 | if (!strcmp(token, "xattr")) { | 958 | if (!strcmp(token, "xattr")) { |
953 | opts->flags |= CGRP_ROOT_XATTR; | 959 | opts->flags |= CGRP_ROOT_XATTR; |
954 | continue; | 960 | continue; |