Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1714279 > unrolled thread

[PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior

Started byWaiman Long <longman@redhat.com>
First post2017-08-17 20:30 +0200
Last post2017-08-17 21:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior Waiman Long <longman@redhat.com> - 2017-08-17 20:30 +0200
    Re: [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use  v2 behavior Tejun Heo <tj@kernel.org> - 2017-08-17 20:50 +0200
      Re: [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use  v2 behavior Waiman Long <longman@redhat.com> - 2017-08-17 21:00 +0200

#1714279 — [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior

FromWaiman Long <longman@redhat.com>
Date2017-08-17 20:30 +0200
Subject[PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior
Message-ID<ufxIl-bd-3@gated-at.bofh.it>
For some cgroup controllers, the behavior on cgroup v1 differs somewhat
from cgroup v2. To indicate that a controller can use v2 behavior
in cgroup v1, a new cgroupfs mount option "v2_mode" is added. This
is essentially a hint, there is no obligation for a controller to
comply with this semantics.

Signed-off-by: Waiman Long <longman@redhat.com>
---
 include/linux/cgroup-defs.h | 5 +++++
 kernel/cgroup/cgroup-v1.c   | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 09f4c7d..fae33ed 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -74,6 +74,11 @@ enum {
 	 * aren't writeable from inside the namespace.
 	 */
 	CGRP_ROOT_NS_DELEGATE	= (1 << 3),
+
+	/*
+	 * A hint that v1 cgroup should use v2 behavior, if applicable.
+	 */
+	CGRP_ROOT_V2_MODE	= (1 << 4),
 };
 
 /* cftype->flags */
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 7bf4b15..77e22a4 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -846,6 +846,8 @@ static int cgroup1_show_options(struct seq_file *seq, struct kernfs_root *kf_roo
 		seq_puts(seq, ",noprefix");
 	if (root->flags & CGRP_ROOT_XATTR)
 		seq_puts(seq, ",xattr");
+	if (root->flags & CGRP_ROOT_V2_MODE)
+		seq_puts(seq, ",v2_mode");
 
 	spin_lock(&release_agent_path_lock);
 	if (strlen(root->release_agent_path))
@@ -900,6 +902,10 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
 			opts->cpuset_clone_children = true;
 			continue;
 		}
+		if (!strcmp(token, "v2_mode")) {
+			opts->flags |= CGRP_ROOT_V2_MODE;
+			continue;
+		}
 		if (!strcmp(token, "xattr")) {
 			opts->flags |= CGRP_ROOT_XATTR;
 			continue;
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1714290 — Re: [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior

FromTejun Heo <tj@kernel.org>
Date2017-08-17 20:50 +0200
SubjectRe: [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior
Message-ID<ufy1I-iq-9@gated-at.bofh.it>
In reply to#1714279
Hello, Waiman.

On Thu, Aug 17, 2017 at 02:25:38PM -0400, Waiman Long wrote:
> For some cgroup controllers, the behavior on cgroup v1 differs somewhat
> from cgroup v2. To indicate that a controller can use v2 behavior
> in cgroup v1, a new cgroupfs mount option "v2_mode" is added. This
> is essentially a hint, there is no obligation for a controller to
> comply with this semantics.

Heh, I don't think we can make it a generic flag.  We can't have one
kernel interpreting the option one way and later kernels doing
differently.  Let's just make it cpuset specific - something like
cpuset_v2_mode.

Thanks.

-- 
tejun

[toc] | [prev] | [next] | [standalone]


#1714297 — Re: [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior

FromWaiman Long <longman@redhat.com>
Date2017-08-17 21:00 +0200
SubjectRe: [PATCH v2 1/2] cgroup: Add a hint to allow v1 controller to use v2 behavior
Message-ID<ufybo-mh-21@gated-at.bofh.it>
In reply to#1714290
On 08/17/2017 02:48 PM, Tejun Heo wrote:
> Hello, Waiman.
>
> On Thu, Aug 17, 2017 at 02:25:38PM -0400, Waiman Long wrote:
>> For some cgroup controllers, the behavior on cgroup v1 differs somewhat
>> from cgroup v2. To indicate that a controller can use v2 behavior
>> in cgroup v1, a new cgroupfs mount option "v2_mode" is added. This
>> is essentially a hint, there is no obligation for a controller to
>> comply with this semantics.
> Heh, I don't think we can make it a generic flag.  We can't have one
> kernel interpreting the option one way and later kernels doing
> differently.  Let's just make it cpuset specific - something like
> cpuset_v2_mode.
>
> Thanks.
>
That is fine for me. I will update the patchset accordingly.

Thanks,
Longman

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web