aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cgroups/cgroups.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/cgroups/cgroups.txt')
-rw-r--r--Documentation/cgroups/cgroups.txt42
1 files changed, 29 insertions, 13 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index d9e5d6f41b92..6eb1a97e88ce 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -56,7 +56,7 @@ hierarchy, and a set of subsystems; each subsystem has system-specific
56state attached to each cgroup in the hierarchy. Each hierarchy has 56state attached to each cgroup in the hierarchy. Each hierarchy has
57an instance of the cgroup virtual filesystem associated with it. 57an instance of the cgroup virtual filesystem associated with it.
58 58
59At any one time there may be multiple active hierachies of task 59At any one time there may be multiple active hierarchies of task
60cgroups. Each hierarchy is a partition of all tasks in the system. 60cgroups. Each hierarchy is a partition of all tasks in the system.
61 61
62User level code may create and destroy cgroups by name in an 62User level code may create and destroy cgroups by name in an
@@ -124,10 +124,10 @@ following lines:
124 / \ 124 / \
125 Prof (15%) students (5%) 125 Prof (15%) students (5%)
126 126
127Browsers like firefox/lynx go into the WWW network class, while (k)nfsd go 127Browsers like Firefox/Lynx go into the WWW network class, while (k)nfsd go
128into NFS network class. 128into NFS network class.
129 129
130At the same time firefox/lynx will share an appropriate CPU/Memory class 130At the same time Firefox/Lynx will share an appropriate CPU/Memory class
131depending on who launched it (prof/student). 131depending on who launched it (prof/student).
132 132
133With the ability to classify tasks differently for different resources 133With the ability to classify tasks differently for different resources
@@ -252,10 +252,8 @@ cgroup file system directories.
252When a task is moved from one cgroup to another, it gets a new 252When a task is moved from one cgroup to another, it gets a new
253css_set pointer - if there's an already existing css_set with the 253css_set pointer - if there's an already existing css_set with the
254desired collection of cgroups then that group is reused, else a new 254desired collection of cgroups then that group is reused, else a new
255css_set is allocated. Note that the current implementation uses a 255css_set is allocated. The appropriate existing css_set is located by
256linear search to locate an appropriate existing css_set, so isn't 256looking into a hash table.
257very efficient. A future version will use a hash table for better
258performance.
259 257
260To allow access from a cgroup to the css_sets (and hence tasks) 258To allow access from a cgroup to the css_sets (and hence tasks)
261that comprise it, a set of cg_cgroup_link objects form a lattice; 259that comprise it, a set of cg_cgroup_link objects form a lattice;
@@ -327,7 +325,7 @@ and then start a subshell 'sh' in that cgroup:
327Creating, modifying, using the cgroups can be done through the cgroup 325Creating, modifying, using the cgroups can be done through the cgroup
328virtual filesystem. 326virtual filesystem.
329 327
330To mount a cgroup hierarchy will all available subsystems, type: 328To mount a cgroup hierarchy with all available subsystems, type:
331# mount -t cgroup xxx /dev/cgroup 329# mount -t cgroup xxx /dev/cgroup
332 330
333The "xxx" is not interpreted by the cgroup code, but will appear in 331The "xxx" is not interpreted by the cgroup code, but will appear in
@@ -335,12 +333,23 @@ The "xxx" is not interpreted by the cgroup code, but will appear in
335 333
336To mount a cgroup hierarchy with just the cpuset and numtasks 334To mount a cgroup hierarchy with just the cpuset and numtasks
337subsystems, type: 335subsystems, type:
338# mount -t cgroup -o cpuset,numtasks hier1 /dev/cgroup 336# mount -t cgroup -o cpuset,memory hier1 /dev/cgroup
339 337
340To change the set of subsystems bound to a mounted hierarchy, just 338To change the set of subsystems bound to a mounted hierarchy, just
341remount with different options: 339remount with different options:
340# mount -o remount,cpuset,ns hier1 /dev/cgroup
342 341
343# mount -o remount,cpuset,ns /dev/cgroup 342Now memory is removed from the hierarchy and ns is added.
343
344Note this will add ns to the hierarchy but won't remove memory or
345cpuset, because the new options are appended to the old ones:
346# mount -o remount,ns /dev/cgroup
347
348To Specify a hierarchy's release_agent:
349# mount -t cgroup -o cpuset,release_agent="/sbin/cpuset_release_agent" \
350 xxx /dev/cgroup
351
352Note that specifying 'release_agent' more than once will return failure.
344 353
345Note that changing the set of subsystems is currently only supported 354Note that changing the set of subsystems is currently only supported
346when the hierarchy consists of a single (root) cgroup. Supporting 355when the hierarchy consists of a single (root) cgroup. Supporting
@@ -351,6 +360,11 @@ Then under /dev/cgroup you can find a tree that corresponds to the
351tree of the cgroups in the system. For instance, /dev/cgroup 360tree of the cgroups in the system. For instance, /dev/cgroup
352is the cgroup that holds the whole system. 361is the cgroup that holds the whole system.
353 362
363If you want to change the value of release_agent:
364# echo "/sbin/new_release_agent" > /dev/cgroup/release_agent
365
366It can also be changed via remount.
367
354If you want to create a new cgroup under /dev/cgroup: 368If you want to create a new cgroup under /dev/cgroup:
355# cd /dev/cgroup 369# cd /dev/cgroup
356# mkdir my_cgroup 370# mkdir my_cgroup
@@ -478,11 +492,13 @@ cgroup->parent is still valid. (Note - can also be called for a
478newly-created cgroup if an error occurs after this subsystem's 492newly-created cgroup if an error occurs after this subsystem's
479create() method has been called for the new cgroup). 493create() method has been called for the new cgroup).
480 494
481void pre_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp); 495int pre_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp);
482 496
483Called before checking the reference count on each subsystem. This may 497Called before checking the reference count on each subsystem. This may
484be useful for subsystems which have some extra references even if 498be useful for subsystems which have some extra references even if
485there are not tasks in the cgroup. 499there are not tasks in the cgroup. If pre_destroy() returns error code,
500rmdir() will fail with it. From this behavior, pre_destroy() can be
501called multiple times against a cgroup.
486 502
487int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, 503int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
488 struct task_struct *task) 504 struct task_struct *task)
@@ -523,7 +539,7 @@ always handled well.
523void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp) 539void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp)
524(cgroup_mutex held by caller) 540(cgroup_mutex held by caller)
525 541
526Called at the end of cgroup_clone() to do any paramater 542Called at the end of cgroup_clone() to do any parameter
527initialization which might be required before a task could attach. For 543initialization which might be required before a task could attach. For
528example in cpusets, no task may attach before 'cpus' and 'mems' are set 544example in cpusets, no task may attach before 'cpus' and 'mems' are set
529up. 545up.