Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / Documentation / cgroups.txt
blob187a81c59c6bfa21af3110363b20f8a297d41574
1                                 CGROUPS
2                                 -------
4 Written by Paul Menage <menage@google.com> based on Documentation/cpusets.txt
6 Original copyright statements from cpusets.txt:
7 Portions Copyright (C) 2004 BULL SA.
8 Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.
9 Modified by Paul Jackson <pj@sgi.com>
10 Modified by Christoph Lameter <clameter@sgi.com>
12 CONTENTS:
13 =========
15 1. Control Groups
16   1.1 What are cgroups ?
17   1.2 Why are cgroups needed ?
18   1.3 How are cgroups implemented ?
19   1.4 What does notify_on_release do ?
20   1.5 How do I use cgroups ?
21 2. Usage Examples and Syntax
22   2.1 Basic Usage
23   2.2 Attaching processes
24 3. Kernel API
25   3.1 Overview
26   3.2 Synchronization
27   3.3 Subsystem API
28 4. Questions
30 1. Control Groups
31 <<<<<<< HEAD:Documentation/cgroups.txt
32 ==========
33 =======
34 =================
35 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
37 1.1 What are cgroups ?
38 ----------------------
40 Control Groups provide a mechanism for aggregating/partitioning sets of
41 tasks, and all their future children, into hierarchical groups with
42 specialized behaviour.
44 Definitions:
46 A *cgroup* associates a set of tasks with a set of parameters for one
47 or more subsystems.
49 A *subsystem* is a module that makes use of the task grouping
50 facilities provided by cgroups to treat groups of tasks in
51 particular ways. A subsystem is typically a "resource controller" that
52 schedules a resource or applies per-cgroup limits, but it may be
53 anything that wants to act on a group of processes, e.g. a
54 virtualization subsystem.
56 A *hierarchy* is a set of cgroups arranged in a tree, such that
57 every task in the system is in exactly one of the cgroups in the
58 hierarchy, and a set of subsystems; each subsystem has system-specific
59 state attached to each cgroup in the hierarchy.  Each hierarchy has
60 an instance of the cgroup virtual filesystem associated with it.
62 At any one time there may be multiple active hierachies of task
63 cgroups. Each hierarchy is a partition of all tasks in the system.
65 User level code may create and destroy cgroups by name in an
66 instance of the cgroup virtual file system, specify and query to
67 which cgroup a task is assigned, and list the task pids assigned to
68 a cgroup. Those creations and assignments only affect the hierarchy
69 associated with that instance of the cgroup file system.
71 On their own, the only use for cgroups is for simple job
72 tracking. The intention is that other subsystems hook into the generic
73 cgroup support to provide new attributes for cgroups, such as
74 accounting/limiting the resources which processes in a cgroup can
75 access. For example, cpusets (see Documentation/cpusets.txt) allows
76 you to associate a set of CPUs and a set of memory nodes with the
77 tasks in each cgroup.
79 1.2 Why are cgroups needed ?
80 ----------------------------
82 There are multiple efforts to provide process aggregations in the
83 Linux kernel, mainly for resource tracking purposes. Such efforts
84 include cpusets, CKRM/ResGroups, UserBeanCounters, and virtual server
85 namespaces. These all require the basic notion of a
86 grouping/partitioning of processes, with newly forked processes ending
87 in the same group (cgroup) as their parent process.
89 The kernel cgroup patch provides the minimum essential kernel
90 mechanisms required to efficiently implement such groups. It has
91 minimal impact on the system fast paths, and provides hooks for
92 specific subsystems such as cpusets to provide additional behaviour as
93 desired.
95 Multiple hierarchy support is provided to allow for situations where
96 the division of tasks into cgroups is distinctly different for
97 different subsystems - having parallel hierarchies allows each
98 hierarchy to be a natural division of tasks, without having to handle
99 complex combinations of tasks that would be present if several
100 unrelated subsystems needed to be forced into the same tree of
101 cgroups.
103 At one extreme, each resource controller or subsystem could be in a
104 separate hierarchy; at the other extreme, all subsystems
105 would be attached to the same hierarchy.
107 As an example of a scenario (originally proposed by vatsa@in.ibm.com)
108 that can benefit from multiple hierarchies, consider a large
109 university server with various users - students, professors, system
110 tasks etc. The resource planning for this server could be along the
111 following lines:
113        CPU :           Top cpuset
114                        /       \
115                CPUSet1         CPUSet2
116                   |              |
117                (Profs)         (Students)
119                In addition (system tasks) are attached to topcpuset (so
120                that they can run anywhere) with a limit of 20%
122        Memory : Professors (50%), students (30%), system (20%)
124        Disk : Prof (50%), students (30%), system (20%)
126        Network : WWW browsing (20%), Network File System (60%), others (20%)
127                                / \
128                        Prof (15%) students (5%)
130 Browsers like firefox/lynx go into the WWW network class, while (k)nfsd go
131 into NFS network class.
133 At the same time firefox/lynx will share an appropriate CPU/Memory class
134 depending on who launched it (prof/student).
136 With the ability to classify tasks differently for different resources
137 (by putting those resource subsystems in different hierarchies) then
138 the admin can easily set up a script which receives exec notifications
139 and depending on who is launching the browser he can
141        # echo browser_pid > /mnt/<restype>/<userclass>/tasks
143 With only a single hierarchy, he now would potentially have to create
144 a separate cgroup for every browser launched and associate it with
145 approp network and other resource class.  This may lead to
146 proliferation of such cgroups.
148 Also lets say that the administrator would like to give enhanced network
149 access temporarily to a student's browser (since it is night and the user
150 <<<<<<< HEAD:Documentation/cgroups.txt
151 wants to do online gaming :)  OR give one of the students simulation
152 =======
153 wants to do online gaming :))  OR give one of the students simulation
154 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
155 apps enhanced CPU power,
157 <<<<<<< HEAD:Documentation/cgroups.txt
158 With ability to write pids directly to resource classes, its just a
159 =======
160 With ability to write pids directly to resource classes, it's just a
161 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
162 matter of :
164        # echo pid > /mnt/network/<new_class>/tasks
165        (after some time)
166        # echo pid > /mnt/network/<orig_class>/tasks
168 Without this ability, he would have to split the cgroup into
169 multiple separate ones and then associate the new cgroups with the
170 new resource classes.
174 1.3 How are cgroups implemented ?
175 ---------------------------------
177 Control Groups extends the kernel as follows:
179  - Each task in the system has a reference-counted pointer to a
180    css_set.
182  - A css_set contains a set of reference-counted pointers to
183    cgroup_subsys_state objects, one for each cgroup subsystem
184    registered in the system. There is no direct link from a task to
185    the cgroup of which it's a member in each hierarchy, but this
186    can be determined by following pointers through the
187    cgroup_subsys_state objects. This is because accessing the
188    subsystem state is something that's expected to happen frequently
189    and in performance-critical code, whereas operations that require a
190    task's actual cgroup assignments (in particular, moving between
191    cgroups) are less common. A linked list runs through the cg_list
192    field of each task_struct using the css_set, anchored at
193    css_set->tasks.
195  - A cgroup hierarchy filesystem can be mounted  for browsing and
196    manipulation from user space.
198  - You can list all the tasks (by pid) attached to any cgroup.
200 The implementation of cgroups requires a few, simple hooks
201 into the rest of the kernel, none in performance critical paths:
203  - in init/main.c, to initialize the root cgroups and initial
204    css_set at system boot.
206  - in fork and exit, to attach and detach a task from its css_set.
208 In addition a new file system, of type "cgroup" may be mounted, to
209 enable browsing and modifying the cgroups presently known to the
210 kernel.  When mounting a cgroup hierarchy, you may specify a
211 comma-separated list of subsystems to mount as the filesystem mount
212 options.  By default, mounting the cgroup filesystem attempts to
213 mount a hierarchy containing all registered subsystems.
215 If an active hierarchy with exactly the same set of subsystems already
216 exists, it will be reused for the new mount. If no existing hierarchy
217 matches, and any of the requested subsystems are in use in an existing
218 hierarchy, the mount will fail with -EBUSY. Otherwise, a new hierarchy
219 is activated, associated with the requested subsystems.
221 It's not currently possible to bind a new subsystem to an active
222 cgroup hierarchy, or to unbind a subsystem from an active cgroup
223 hierarchy. This may be possible in future, but is fraught with nasty
224 error-recovery issues.
226 When a cgroup filesystem is unmounted, if there are any
227 child cgroups created below the top-level cgroup, that hierarchy
228 will remain active even though unmounted; if there are no
229 child cgroups then the hierarchy will be deactivated.
231 No new system calls are added for cgroups - all support for
232 querying and modifying cgroups is via this cgroup file system.
234 Each task under /proc has an added file named 'cgroup' displaying,
235 for each active hierarchy, the subsystem names and the cgroup name
236 as the path relative to the root of the cgroup file system.
238 Each cgroup is represented by a directory in the cgroup file system
239 containing the following files describing that cgroup:
241  - tasks: list of tasks (by pid) attached to that cgroup
242 <<<<<<< HEAD:Documentation/cgroups.txt
243  - notify_on_release flag: run /sbin/cgroup_release_agent on exit?
244 =======
245  - releasable flag: cgroup currently removeable?
246  - notify_on_release flag: run the release agent on exit?
247  - release_agent: the path to use for release notifications (this file
248    exists in the top cgroup only)
249 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
251 Other subsystems such as cpusets may add additional files in each
252 <<<<<<< HEAD:Documentation/cgroups.txt
253 cgroup dir
254 =======
255 cgroup dir.
256 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
258 New cgroups are created using the mkdir system call or shell
259 command.  The properties of a cgroup, such as its flags, are
260 modified by writing to the appropriate file in that cgroups
261 directory, as listed above.
263 The named hierarchical structure of nested cgroups allows partitioning
264 a large system into nested, dynamically changeable, "soft-partitions".
266 The attachment of each task, automatically inherited at fork by any
267 children of that task, to a cgroup allows organizing the work load
268 on a system into related sets of tasks.  A task may be re-attached to
269 any other cgroup, if allowed by the permissions on the necessary
270 cgroup file system directories.
272 When a task is moved from one cgroup to another, it gets a new
273 css_set pointer - if there's an already existing css_set with the
274 desired collection of cgroups then that group is reused, else a new
275 css_set is allocated. Note that the current implementation uses a
276 linear search to locate an appropriate existing css_set, so isn't
277 very efficient. A future version will use a hash table for better
278 performance.
280 To allow access from a cgroup to the css_sets (and hence tasks)
281 that comprise it, a set of cg_cgroup_link objects form a lattice;
282 each cg_cgroup_link is linked into a list of cg_cgroup_links for
283 <<<<<<< HEAD:Documentation/cgroups.txt
284 a single cgroup on its cont_link_list field, and a list of
285 =======
286 a single cgroup on its cgrp_link_list field, and a list of
287 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
288 cg_cgroup_links for a single css_set on its cg_link_list.
290 Thus the set of tasks in a cgroup can be listed by iterating over
291 each css_set that references the cgroup, and sub-iterating over
292 each css_set's task set.
294 The use of a Linux virtual file system (vfs) to represent the
295 cgroup hierarchy provides for a familiar permission and name space
296 for cgroups, with a minimum of additional kernel code.
298 1.4 What does notify_on_release do ?
299 ------------------------------------
301 <<<<<<< HEAD:Documentation/cgroups.txt
302 *** notify_on_release is disabled in the current patch set. It will be
303 *** reactivated in a future patch in a less-intrusive manner
305 =======
306 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
307 If the notify_on_release flag is enabled (1) in a cgroup, then
308 whenever the last task in the cgroup leaves (exits or attaches to
309 some other cgroup) and the last child cgroup of that cgroup
310 is removed, then the kernel runs the command specified by the contents
311 of the "release_agent" file in that hierarchy's root directory,
312 supplying the pathname (relative to the mount point of the cgroup
313 file system) of the abandoned cgroup.  This enables automatic
314 removal of abandoned cgroups.  The default value of
315 notify_on_release in the root cgroup at system boot is disabled
316 (0).  The default value of other cgroups at creation is the current
317 value of their parents notify_on_release setting. The default value of
318 a cgroup hierarchy's release_agent path is empty.
320 1.5 How do I use cgroups ?
321 --------------------------
323 To start a new job that is to be contained within a cgroup, using
324 the "cpuset" cgroup subsystem, the steps are something like:
326  1) mkdir /dev/cgroup
327  2) mount -t cgroup -ocpuset cpuset /dev/cgroup
328  3) Create the new cgroup by doing mkdir's and write's (or echo's) in
329     the /dev/cgroup virtual file system.
330  4) Start a task that will be the "founding father" of the new job.
331  5) Attach that task to the new cgroup by writing its pid to the
332     /dev/cgroup tasks file for that cgroup.
333  6) fork, exec or clone the job tasks from this founding father task.
335 For example, the following sequence of commands will setup a cgroup
336 named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
337 and then start a subshell 'sh' in that cgroup:
339   mount -t cgroup cpuset -ocpuset /dev/cgroup
340   cd /dev/cgroup
341   mkdir Charlie
342   cd Charlie
343   /bin/echo 2-3 > cpus
344   /bin/echo 1 > mems
345   /bin/echo $$ > tasks
346   sh
347   # The subshell 'sh' is now running in cgroup Charlie
348   # The next line should display '/Charlie'
349   cat /proc/self/cgroup
351 2. Usage Examples and Syntax
352 ============================
354 2.1 Basic Usage
355 ---------------
357 Creating, modifying, using the cgroups can be done through the cgroup
358 virtual filesystem.
360 To mount a cgroup hierarchy will all available subsystems, type:
361 # mount -t cgroup xxx /dev/cgroup
363 The "xxx" is not interpreted by the cgroup code, but will appear in
364 /proc/mounts so may be any useful identifying string that you like.
366 To mount a cgroup hierarchy with just the cpuset and numtasks
367 subsystems, type:
368 # mount -t cgroup -o cpuset,numtasks hier1 /dev/cgroup
370 To change the set of subsystems bound to a mounted hierarchy, just
371 remount with different options:
373 # mount -o remount,cpuset,ns  /dev/cgroup
375 Note that changing the set of subsystems is currently only supported
376 when the hierarchy consists of a single (root) cgroup. Supporting
377 the ability to arbitrarily bind/unbind subsystems from an existing
378 cgroup hierarchy is intended to be implemented in the future.
380 Then under /dev/cgroup you can find a tree that corresponds to the
381 tree of the cgroups in the system. For instance, /dev/cgroup
382 is the cgroup that holds the whole system.
384 If you want to create a new cgroup under /dev/cgroup:
385 # cd /dev/cgroup
386 # mkdir my_cgroup
388 Now you want to do something with this cgroup.
389 # cd my_cgroup
391 In this directory you can find several files:
392 # ls
393 <<<<<<< HEAD:Documentation/cgroups.txt
394 notify_on_release release_agent tasks
395 (plus whatever files are added by the attached subsystems)
396 =======
397 notify_on_release releasable tasks
398 (plus whatever files added by the attached subsystems)
399 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
401 Now attach your shell to this cgroup:
402 # /bin/echo $$ > tasks
404 You can also create cgroups inside your cgroup by using mkdir in this
405 directory.
406 # mkdir my_sub_cs
408 To remove a cgroup, just use rmdir:
409 # rmdir my_sub_cs
411 This will fail if the cgroup is in use (has cgroups inside, or
412 has processes attached, or is held alive by other subsystem-specific
413 reference).
415 2.2 Attaching processes
416 -----------------------
418 # /bin/echo PID > tasks
420 Note that it is PID, not PIDs. You can only attach ONE task at a time.
421 If you have several tasks to attach, you have to do it one after another:
423 # /bin/echo PID1 > tasks
424 # /bin/echo PID2 > tasks
425         ...
426 # /bin/echo PIDn > tasks
428 3. Kernel API
429 =============
431 3.1 Overview
432 ------------
434 Each kernel subsystem that wants to hook into the generic cgroup
435 system needs to create a cgroup_subsys object. This contains
436 various methods, which are callbacks from the cgroup system, along
437 with a subsystem id which will be assigned by the cgroup system.
439 Other fields in the cgroup_subsys object include:
441 - subsys_id: a unique array index for the subsystem, indicating which
442 <<<<<<< HEAD:Documentation/cgroups.txt
443   entry in cgroup->subsys[] this subsystem should be
444   managing. Initialized by cgroup_register_subsys(); prior to this
445   it should be initialized to -1
446 =======
447   entry in cgroup->subsys[] this subsystem should be managing.
448 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
450 <<<<<<< HEAD:Documentation/cgroups.txt
451 - hierarchy: an index indicating which hierarchy, if any, this
452   subsystem is currently attached to. If this is -1, then the
453   subsystem is not attached to any hierarchy, and all tasks should be
454   considered to be members of the subsystem's top_cgroup. It should
455   be initialized to -1.
456 =======
457 - name: should be initialized to a unique subsystem name. Should be
458   no longer than MAX_CGROUP_TYPE_NAMELEN.
459 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
461 <<<<<<< HEAD:Documentation/cgroups.txt
462 - name: should be initialized to a unique subsystem name prior to
463   calling cgroup_register_subsystem. Should be no longer than
464   MAX_CGROUP_TYPE_NAMELEN
465 =======
466 - early_init: indicate if the subsystem needs early initialization
467   at system boot.
468 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
470 Each cgroup object created by the system has an array of pointers,
471 indexed by subsystem id; this pointer is entirely managed by the
472 subsystem; the generic cgroup code will never touch this pointer.
474 3.2 Synchronization
475 -------------------
477 There is a global mutex, cgroup_mutex, used by the cgroup
478 system. This should be taken by anything that wants to modify a
479 cgroup. It may also be taken to prevent cgroups from being
480 modified, but more specific locks may be more appropriate in that
481 situation.
483 See kernel/cgroup.c for more details.
485 Subsystems can take/release the cgroup_mutex via the functions
486 <<<<<<< HEAD:Documentation/cgroups.txt
487 cgroup_lock()/cgroup_unlock(), and can
488 take/release the callback_mutex via the functions
489 =======
490 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
491 cgroup_lock()/cgroup_unlock().
493 Accessing a task's cgroup pointer may be done in the following ways:
494 - while holding cgroup_mutex
495 - while holding the task's alloc_lock (via task_lock())
496 - inside an rcu_read_lock() section via rcu_dereference()
498 3.3 Subsystem API
499 <<<<<<< HEAD:Documentation/cgroups.txt
500 --------------------------
501 =======
502 -----------------
503 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
505 Each subsystem should:
507 - add an entry in linux/cgroup_subsys.h
508 - define a cgroup_subsys object called <name>_subsys
510 Each subsystem may export the following methods. The only mandatory
511 methods are create/destroy. Any others that are null are presumed to
512 be successful no-ops.
514 <<<<<<< HEAD:Documentation/cgroups.txt
515 struct cgroup_subsys_state *create(struct cgroup *cont)
516 =======
517 struct cgroup_subsys_state *create(struct cgroup_subsys *ss,
518                                    struct cgroup *cgrp)
519 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
520 (cgroup_mutex held by caller)
522 Called to create a subsystem state object for a cgroup. The
523 subsystem should allocate its subsystem state object for the passed
524 cgroup, returning a pointer to the new object on success or a
525 negative error code. On success, the subsystem pointer should point to
526 a structure of type cgroup_subsys_state (typically embedded in a
527 larger subsystem-specific object), which will be initialized by the
528 cgroup system. Note that this will be called at initialization to
529 create the root subsystem state for this subsystem; this case can be
530 identified by the passed cgroup object having a NULL parent (since
531 it's the root of the hierarchy) and may be an appropriate place for
532 initialization code.
534 <<<<<<< HEAD:Documentation/cgroups.txt
535 void destroy(struct cgroup *cont)
536 =======
537 void destroy(struct cgroup_subsys *ss, struct cgroup *cgrp)
538 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
539 (cgroup_mutex held by caller)
541 The cgroup system is about to destroy the passed cgroup; the subsystem
542 should do any necessary cleanup and free its subsystem state
543 object. By the time this method is called, the cgroup has already been
544 unlinked from the file system and from the child list of its parent;
545 cgroup->parent is still valid. (Note - can also be called for a
546 newly-created cgroup if an error occurs after this subsystem's
547 create() method has been called for the new cgroup).
549 <<<<<<< HEAD:Documentation/cgroups.txt
550 int can_attach(struct cgroup_subsys *ss, struct cgroup *cont,
551 =======
552 void pre_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp);
553 (cgroup_mutex held by caller)
555 Called before checking the reference count on each subsystem. This may
556 be useful for subsystems which have some extra references even if
557 there are not tasks in the cgroup.
559 int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
560 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
561                struct task_struct *task)
562 (cgroup_mutex held by caller)
564 Called prior to moving a task into a cgroup; if the subsystem
565 returns an error, this will abort the attach operation.  If a NULL
566 task is passed, then a successful result indicates that *any*
567 unspecified task can be moved into the cgroup. Note that this isn't
568 called on a fork. If this method returns 0 (success) then this should
569 remain valid while the caller holds cgroup_mutex.
571 <<<<<<< HEAD:Documentation/cgroups.txt
572 void attach(struct cgroup_subsys *ss, struct cgroup *cont,
573             struct cgroup *old_cont, struct task_struct *task)
574 =======
575 void attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
576             struct cgroup *old_cgrp, struct task_struct *task)
577 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
579 Called after the task has been attached to the cgroup, to allow any
580 post-attachment activity that requires memory allocations or blocking.
582 void fork(struct cgroup_subsy *ss, struct task_struct *task)
584 Called when a task is forked into a cgroup. Also called during
585 registration for all existing tasks.
587 void exit(struct cgroup_subsys *ss, struct task_struct *task)
589 <<<<<<< HEAD:Documentation/cgroups.txt
590 Called during task exit
591 =======
592 Called during task exit.
593 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
595 <<<<<<< HEAD:Documentation/cgroups.txt
596 int populate(struct cgroup_subsys *ss, struct cgroup *cont)
597 =======
598 int populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
599 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
601 Called after creation of a cgroup to allow a subsystem to populate
602 the cgroup directory with file entries.  The subsystem should make
603 calls to cgroup_add_file() with objects of type cftype (see
604 include/linux/cgroup.h for details).  Note that although this
605 method can return an error code, the error code is currently not
606 always handled well.
608 <<<<<<< HEAD:Documentation/cgroups.txt
609 void post_clone(struct cgroup_subsys *ss, struct cgroup *cont)
610 =======
611 void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp)
612 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:Documentation/cgroups.txt
614 Called at the end of cgroup_clone() to do any paramater
615 initialization which might be required before a task could attach.  For
616 example in cpusets, no task may attach before 'cpus' and 'mems' are set
619 void bind(struct cgroup_subsys *ss, struct cgroup *root)
620 (cgroup_mutex held by caller)
622 Called when a cgroup subsystem is rebound to a different hierarchy
623 and root cgroup. Currently this will only involve movement between
624 the default hierarchy (which never has sub-cgroups) and a hierarchy
625 that is being created/destroyed (and hence has no sub-cgroups).
627 4. Questions
628 ============
630 Q: what's up with this '/bin/echo' ?
631 A: bash's builtin 'echo' command does not check calls to write() against
632    errors. If you use it in the cgroup file system, you won't be
633    able to tell whether a command succeeded or failed.
635 Q: When I attach processes, only the first of the line gets really attached !
636 A: We can only return one error code per call to write(). So you should also
637    put only ONE pid.