aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2017-11-06 13:30:29 -0500
committerTejun Heo <tj@kernel.org>2017-11-06 15:01:57 -0500
commit5f2e673405b742be64e7c3604ed4ed3ac14f35ce (patch)
tree485162ac6fa8ae522c8ccfde830d7d40a2d8b069
parent01ee6cfb1483fe57c9cbd8e73817dfbf9bacffd3 (diff)
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. 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 Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--kernel/cgroup/cgroup.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index eed92ed624e5..69e65d28fe98 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,
5877} 5877}
5878static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate); 5878static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate);
5879 5879
5880static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr,
5881 char *buf)
5882{
5883 return snprintf(buf, PAGE_SIZE, "nsdelegate\n");
5884}
5885static struct kobj_attribute cgroup_features_attr = __ATTR_RO(features);
5886
5880static struct attribute *cgroup_sysfs_attrs[] = { 5887static struct attribute *cgroup_sysfs_attrs[] = {
5881 &cgroup_delegate_attr.attr, 5888 &cgroup_delegate_attr.attr,
5889 &cgroup_features_attr.attr,
5882 NULL, 5890 NULL,
5883}; 5891};
5884 5892