From: Roman Gushchin <guro@fb.com>
To: Tejun Heo <tj@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <kernel-team@fb.com>,
Roman Gushchin <guro@fb.com>
Subject: [PATCH 2/2] cgroup: export list of cgroups v2 features using sysfs
Date: Fri, 3 Nov 2017 13:46:03 -0400 [thread overview]
Message-ID: <20171103174603.15249-2-guro@fb.com> (raw)
In-Reply-To: <20171103174603.15249-1-guro@fb.com>
The active development of cgroups v2 sometimes leads to a creation
of interfaces, which are not turned on by default (to provide
backward compatibility). It's handy to know from userspace, which
cgroup v2 features are supported without calculating it based
on the kernel version. So, let's export the list of such features
using /sys/kernel/cgroup/features pseudo-file.
The list is hardcoded and has to be extended when new functionality
is added. Each feature is printed on a new line.
Example:
$ cat /sys/kernel/cgroup/features
nsdelegate
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: kernel-team@fb.com
---
kernel/cgroup/cgroup.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 9dff92c17a1f..548b12609943 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5877,8 +5877,16 @@ static ssize_t delegates_show(struct kobject *kobj, struct kobj_attribute *attr,
}
static struct kobj_attribute cgroup_delegates_attr = __ATTR_RO(delegates);
+static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr,
+ char *buf)
+{
+ return snprintf(buf, PAGE_SIZE, "nsdelegate\n");
+}
+static struct kobj_attribute cgroup_features_attr = __ATTR_RO(features);
+
static struct attribute *cgroup_sysfs_attrs[] = {
&cgroup_delegates_attr.attr,
+ &cgroup_features_attr.attr,
NULL,
};
--
2.13.6
next prev parent reply other threads:[~2017-11-03 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 17:46 [PATCH 1/2] cgroup: export list of delegatable control files using sysfs Roman Gushchin
2017-11-03 17:46 ` Roman Gushchin [this message]
2017-11-03 17:56 ` Tejun Heo
2017-11-06 17:38 ` Tejun Heo
2017-11-06 18:30 ` [PATCH v2 " Roman Gushchin
2017-11-06 18:30 ` [PATCH v2 2/2] cgroup: export list of cgroups v2 features " Roman Gushchin
2017-11-06 20:02 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171103174603.15249-2-guro@fb.com \
--to=guro@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox