1 From f33ce8d7dcb3053b513003fb775d6457d30d4921 Mon Sep 17 00:00:00 2001
2 From: Waiman Long <longman@redhat.com>
3 Date: Thu, 17 Aug 2017 15:33:09 -0400
4 Subject: [PATCH 005/241] cgroup: Add mount flag to enable cpuset to use v2
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 A new mount option "cpuset_v2_mode" is added to the v1 cgroupfs
11 filesystem to enable cpuset controller to use v2 behavior in a v1
12 cgroup. This mount option applies only to cpuset controller and have
13 no effect on other controllers.
15 Signed-off-by: Waiman Long <longman@redhat.com>
16 Signed-off-by: Tejun Heo <tj@kernel.org>
17 (cherry-picked from e1cba4b85daa71b710384d451ff6238d5e4d1ff6)
18 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
20 include/linux/cgroup-defs.h | 5 +++++
21 kernel/cgroup/cgroup-v1.c | 6 ++++++
22 2 files changed, 11 insertions(+)
24 diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
25 index 09f4c7df1478..c344e77707a5 100644
26 --- a/include/linux/cgroup-defs.h
27 +++ b/include/linux/cgroup-defs.h
28 @@ -74,6 +74,11 @@ enum {
29 * aren't writeable from inside the namespace.
31 CGRP_ROOT_NS_DELEGATE = (1 << 3),
34 + * Enable cpuset controller in v1 cgroup to use v2 behavior.
36 + CGRP_ROOT_CPUSET_V2_MODE = (1 << 4),
40 diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
41 index 7bf4b1533f34..ce7426b875f5 100644
42 --- a/kernel/cgroup/cgroup-v1.c
43 +++ b/kernel/cgroup/cgroup-v1.c
44 @@ -846,6 +846,8 @@ static int cgroup1_show_options(struct seq_file *seq, struct kernfs_root *kf_roo
45 seq_puts(seq, ",noprefix");
46 if (root->flags & CGRP_ROOT_XATTR)
47 seq_puts(seq, ",xattr");
48 + if (root->flags & CGRP_ROOT_CPUSET_V2_MODE)
49 + seq_puts(seq, ",cpuset_v2_mode");
51 spin_lock(&release_agent_path_lock);
52 if (strlen(root->release_agent_path))
53 @@ -900,6 +902,10 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
54 opts->cpuset_clone_children = true;
57 + if (!strcmp(token, "cpuset_v2_mode")) {
58 + opts->flags |= CGRP_ROOT_CPUSET_V2_MODE;
61 if (!strcmp(token, "xattr")) {
62 opts->flags |= CGRP_ROOT_XATTR;