diff options
author | Daniel Lezcano <daniel.lezcano@free.fr> | 2010-10-27 18:33:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:09 -0400 |
commit | 97978e6d1f2da0073416870410459694fbdbfd9b (patch) | |
tree | e8ff2fe4119d03fa54a45e8a101adbf9fb91a385 /Documentation | |
parent | 2d3cbf8bc852ac1bc3d098186143c5973f87b753 (diff) |
cgroup: add clone_children control file
The ns_cgroup is a control group interacting with the namespaces. When a
new namespace is created, a corresponding cgroup is automatically created
too. The cgroup name is the pid of the process who did 'unshare' or the
child of 'clone'.
This cgroup is tied with the namespace because it prevents a process to
escape the control group and use the post_clone callback, so the child
cgroup inherits the values of the parent cgroup.
Unfortunately, the more we use this cgroup and the more we are facing
problems with it:
(1) when a process unshares, the cgroup name may conflict with a
previous cgroup with the same pid, so unshare or clone return -EEXIST
(2) the cgroup creation is out of control because there may have an
application creating several namespaces where the system will
automatically create several cgroups in his back and let them on the
cgroupfs (eg. a vrf based on the network namespace).
(3) the mix of (1) and (2) force an administrator to regularly check
and clean these cgroups.
This patchset removes the ns_cgroup by adding a new flag to the cgroup and
the cgroupfs mount option. It enables the copy of the parent cgroup when
a child cgroup is created. We can then safely remove the ns_cgroup as
this flag brings a compatibility. We have now to manually create and add
the task to a cgroup, which is consistent with the cgroup framework.
This patch:
Sent as an answer to a previous thread around the ns_cgroup.
https://lists.linux-foundation.org/pipermail/containers/2009-June/018627.html
It adds a control file 'clone_children' for a cgroup. This control file
is a boolean specifying if the child cgroup should be a clone of the
parent cgroup or not. The default value is 'false'.
This flag makes the child cgroup to call the post_clone callback of all
the subsystem, if it is available.
At present, the cpuset is the only one which had implemented the
post_clone callback.
The option can be set at mount time by specifying the 'clone_children'
mount option.
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Paul Menage <menage@google.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jamal Hadi Salim <hadi@cyberus.ca>
Cc: Matt Helsley <matthltc@us.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/cgroups/cgroups.txt | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index b34823ff1646..190018b0c649 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -18,7 +18,8 @@ CONTENTS: | |||
18 | 1.2 Why are cgroups needed ? | 18 | 1.2 Why are cgroups needed ? |
19 | 1.3 How are cgroups implemented ? | 19 | 1.3 How are cgroups implemented ? |
20 | 1.4 What does notify_on_release do ? | 20 | 1.4 What does notify_on_release do ? |
21 | 1.5 How do I use cgroups ? | 21 | 1.5 What does clone_children do ? |
22 | 1.6 How do I use cgroups ? | ||
22 | 2. Usage Examples and Syntax | 23 | 2. Usage Examples and Syntax |
23 | 2.1 Basic Usage | 24 | 2.1 Basic Usage |
24 | 2.2 Attaching processes | 25 | 2.2 Attaching processes |
@@ -293,7 +294,16 @@ notify_on_release in the root cgroup at system boot is disabled | |||
293 | value of their parents notify_on_release setting. The default value of | 294 | value of their parents notify_on_release setting. The default value of |
294 | a cgroup hierarchy's release_agent path is empty. | 295 | a cgroup hierarchy's release_agent path is empty. |
295 | 296 | ||
296 | 1.5 How do I use cgroups ? | 297 | 1.5 What does clone_children do ? |
298 | --------------------------------- | ||
299 | |||
300 | If the clone_children flag is enabled (1) in a cgroup, then all | ||
301 | cgroups created beneath will call the post_clone callbacks for each | ||
302 | subsystem of the newly created cgroup. Usually when this callback is | ||
303 | implemented for a subsystem, it copies the values of the parent | ||
304 | subsystem, this is the case for the cpuset. | ||
305 | |||
306 | 1.6 How do I use cgroups ? | ||
297 | -------------------------- | 307 | -------------------------- |
298 | 308 | ||
299 | To start a new job that is to be contained within a cgroup, using | 309 | To start a new job that is to be contained within a cgroup, using |