diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2007-10-19 02:39:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:37 -0400 |
commit | 858d72ead4864da0fb0b89b919524125ce998e27 (patch) | |
tree | 19ea321ca3b505efecb2053a829daf89a6a22529 /init | |
parent | 846c7bb055747989891f5cd2bb6e8d56243ba1e7 (diff) |
cgroups: implement namespace tracking subsystem
When a task enters a new namespace via a clone() or unshare(), a new cgroup
is created and the task moves into it.
This version names cgroups which are automatically created using
cgroup_clone() as "node_<pid>" where pid is the pid of the unsharing or
cloned process. (Thanks Pavel for the idea) This is safe because if the
process unshares again, it will create
/cgroups/(...)/node_<pid>/node_<pid>
The only possibilities (AFAICT) for a -EEXIST on unshare are
1. pid wraparound
2. a process fails an unshare, then tries again.
Case 1 is unlikely enough that I ignore it (at least for now). In case 2, the
node_<pid> will be empty and can be rmdir'ed to make the subsequent unshare()
succeed.
Changelog:
Name cloned cgroups as "node_<pid>".
[clg@fr.ibm.com: fix order of cgroup subsystems in init/Kconfig]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/init/Kconfig b/init/Kconfig index 6687f805b38d..0007d1b5e867 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -288,6 +288,22 @@ config CGROUP_DEBUG | |||
288 | 288 | ||
289 | Say N if unsure | 289 | Say N if unsure |
290 | 290 | ||
291 | config CGROUP_NS | ||
292 | bool "Namespace cgroup subsystem" | ||
293 | depends on CGROUPS | ||
294 | help | ||
295 | Provides a simple namespace cgroup subsystem to | ||
296 | provide hierarchical naming of sets of namespaces, | ||
297 | for instance virtual servers and checkpoint/restart | ||
298 | jobs. | ||
299 | |||
300 | config CGROUP_CPUACCT | ||
301 | bool "Simple CPU accounting cgroup subsystem" | ||
302 | depends on CGROUPS | ||
303 | help | ||
304 | Provides a simple Resource Controller for monitoring the | ||
305 | total CPU consumed by the tasks in a cgroup | ||
306 | |||
291 | config CPUSETS | 307 | config CPUSETS |
292 | bool "Cpuset support" | 308 | bool "Cpuset support" |
293 | depends on SMP && CGROUPS | 309 | depends on SMP && CGROUPS |
@@ -345,13 +361,6 @@ config PROC_PID_CPUSET | |||
345 | depends on CPUSETS | 361 | depends on CPUSETS |
346 | default y | 362 | default y |
347 | 363 | ||
348 | config CGROUP_CPUACCT | ||
349 | bool "Simple CPU accounting cgroup subsystem" | ||
350 | depends on CGROUPS | ||
351 | help | ||
352 | Provides a simple Resource Controller for monitoring the | ||
353 | total CPU consumed by the tasks in a cgroup | ||
354 | |||
355 | config RELAY | 364 | config RELAY |
356 | bool "Kernel->user space relay support (formerly relayfs)" | 365 | bool "Kernel->user space relay support (formerly relayfs)" |
357 | help | 366 | help |