cgroup: export list of cgroups v2 features using sysfs

This change “cgroup: export list of cgroups v2 features using sysfs” in Linux kernel is authored by Roman Gushchin <guro [at]> on Mon Nov 6 13:30:29 2017 -0500.

cgroup: export list of cgroups v2 features using sysfs

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.

  $ cat /sys/kernel/cgroup/features

Signed-off-by: Roman Gushchin <>
Cc: Tejun Heo <>
Signed-off-by: Tejun Heo <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 5f2e673.

There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 kernel/cgroup/cgroup.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index eed92ed6..69e65d2 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5877,8 +5877,16 @@ static ssize_t delegate_show(struct kobject *kobj, struct kobj_attribute *attr,
 static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate);
+static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr,
+			     char *buf)
+	return snprintf(buf, PAGE_SIZE, "nsdelegaten");
+static struct kobj_attribute cgroup_features_attr = __ATTR_RO(features);
 static struct attribute *cgroup_sysfs_attrs[] = {
+	&cgroup_features_attr.attr,

The commit for this change in Linux stable tree is 5f2e673 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *