Skip to contentSkip to conversation

cgroup: notify ns_cgroup deprecated

PATCH In review Daniel Lezcano 2 participants 2 messages Sep 29, 2010 1 message not in the archive Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup: notify ns_cgroup deprecated

The ns_cgroup will be removed very soon. Let's warn, for this version, ns_cgroup is deprecated.

Make ns_cgroup and clone_children exclusive. If the clone_children is set and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup subsys is created (a printk will help the user to understand why the creation fails).

Update the feature remove schedule file with the deprecated ns_cgroup.

---
 Documentation/feature-removal-schedule.txt |   17 +++++++++++++++++
 kernel/ns_cgroup.c                         |    8 ++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
Documentation/feature-removal-schedule.txt +17 -0
index b32911b..a39e2f3 100644
@@ -545,4 +545,21 @@ Why:    This is a legacy interface which have been replaced by a more
 Who:    NeilBrown <[email protected]>
 
 ----------------------------
+
+What:   namespace cgroup (ns_cgroup)
+When:   2.6.38
+Why:    The ns_cgroup leads to some problems:
+	* cgroup creation is out-of-control
+	* cgroup name can conflict when pids are looping
+	* it is not possible to have a single process handling
+	a lot of namespaces without falling in a exponential creation time
+	* we may want to create a namespace without creating a cgroup
+
+	The ns_cgroup is replaced by a compatibility flag 'clone_children',
+	where a newly created cgroup will copy the parent cgroup values.
+	The userspace has to manually create a cgroup and add a task to
+	the 'tasks' file.
+Who:    Daniel Lezcano <[email protected]>
+
+----------------------------
 	
kernel/ns_cgroup.c +8 -0
index 2a5dfec..2c98ad9 100644
@@ -85,6 +85,14 @@ static struct cgroup_subsys_state *ns_create(struct cgroup_subsys *ss,
 		return ERR_PTR(-EPERM);
 	if (!cgroup_is_descendant(cgroup, current))
 		return ERR_PTR(-EPERM);
+	if (test_bit(CGRP_CLONE_CHILDREN, &cgroup->flags)) {
+		printk("ns_cgroup can't be created with parent "
+		       "'clone_children' set.\n");
+		return ERR_PTR(-EINVAL);
+	}
+
+	printk_once("ns_cgroup deprecated: consider using the "
+		    "'clone_children' flag without the ns_cgroup.\n");
 
 	ns_cgroup = kzalloc(sizeof(*ns_cgroup), GFP_KERNEL);
 	if (!ns_cgroup)
Signature · 1 line
1.7.0.4

A message that is not in the archive (sent off-list or not yet received): 1285795301-2684-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org

Acked-by
#2 lore raw
Quoted 11 lines · Daniel Lezcano

The ns_cgroup will be removed very soon. Let's warn, for this version, ns_cgroup is deprecated.

Make ns_cgroup and clone_children exclusive. If the clone_children is set and the ns_cgroup is mounted, let's fail with EINVAL when the ns_cgroup subsys is created (a printk will help the user to understand why the creation fails).

Update the feature remove schedule file with the deprecated ns_cgroup.

Quoted 54 lines

---
 Documentation/feature-removal-schedule.txt |   17 +++++++++++++++++ kernel/ns_cgroup.c                         |    8 ++++++++

 2 files changed, 25 insertions(+), 0 deletions(-)
Documentation/feature-removal-schedule.txt +0 -0
index b32911b..a39e2f3 100644
@@ -545,4 +545,21 @@ Why:    This is a legacy interface which have been replaced by a more

 Who:    NeilBrown <[email protected]>

 ----------------------------

Documentation/feature-removal-schedule.txt +17 -0
+
+What:   namespace cgroup (ns_cgroup)
+When:   2.6.38
+Why:    The ns_cgroup leads to some problems:
+       * cgroup creation is out-of-control
+       * cgroup name can conflict when pids are looping
+       * it is not possible to have a single process handling
+       a lot of namespaces without falling in a exponential creation time
+       * we may want to create a namespace without creating a cgroup
+
+       The ns_cgroup is replaced by a compatibility flag 'clone_children',
+       where a newly created cgroup will copy the parent cgroup values.
+       The userspace has to manually create a cgroup and add a task to
+       the 'tasks' file.
+Who:    Daniel Lezcano <[email protected]>
+
+----------------------------
kernel/ns_cgroup.c +8 -1
index 2a5dfec..2c98ad9 100644
@@ -85,6 +85,14 @@ static struct cgroup_subsys_state *ns_create(struct cgroup_subsys *ss,
                return ERR_PTR(-EPERM);
        if (!cgroup_is_descendant(cgroup, current))
                return ERR_PTR(-EPERM);
+       if (test_bit(CGRP_CLONE_CHILDREN, &cgroup->flags)) {
+               printk("ns_cgroup can't be created with parent "
+                      "'clone_children' set.\n");
+               return ERR_PTR(-EINVAL);
+       }
+
+       printk_once("ns_cgroup deprecated: consider using the "
+                   "'clone_children' flag without the ns_cgroup.\n");
 
        ns_cgroup = kzalloc(sizeof(*ns_cgroup), GFP_KERNEL);
        if (!ns_cgroup)
--

1.7.0.4