diff options
author | Paul Menage <menage@google.com> | 2008-02-07 03:13:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:18 -0500 |
commit | 8dc4f3e17dd5f7e59ce568155ccd8974af879315 (patch) | |
tree | 959b1197fea798c9daae4dd6c9596ab710d41fda /Documentation/cgroups.txt | |
parent | 622d42cac9ed42098aa50c53994f625abfa3d473 (diff) |
cgroups: move cgroups destroy() callbacks to cgroup_diput()
Move the calls to the cgroup subsystem destroy() methods from
cgroup_rmdir() to cgroup_diput(). This allows control file reads and
writes to access their subsystem state without having to be concerned with
locking against cgroup destruction - the control file dentry will keep the
cgroup and its subsystem state objects alive until the file is closed.
The documentation is updated to reflect the changed semantics of destroy();
additionally the locking comments for destroy() and some other methods were
clarified and decrustified.
Signed-off-by: Paul Menage <menage@google.com>
Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/cgroups.txt')
-rw-r--r-- | Documentation/cgroups.txt | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Documentation/cgroups.txt b/Documentation/cgroups.txt index 98a26f81fa75..42d7c4cb39cd 100644 --- a/Documentation/cgroups.txt +++ b/Documentation/cgroups.txt | |||
@@ -456,7 +456,7 @@ methods are create/destroy. Any others that are null are presumed to | |||
456 | be successful no-ops. | 456 | be successful no-ops. |
457 | 457 | ||
458 | struct cgroup_subsys_state *create(struct cgroup *cont) | 458 | struct cgroup_subsys_state *create(struct cgroup *cont) |
459 | LL=cgroup_mutex | 459 | (cgroup_mutex held by caller) |
460 | 460 | ||
461 | Called to create a subsystem state object for a cgroup. The | 461 | Called to create a subsystem state object for a cgroup. The |
462 | subsystem should allocate its subsystem state object for the passed | 462 | subsystem should allocate its subsystem state object for the passed |
@@ -471,14 +471,19 @@ it's the root of the hierarchy) and may be an appropriate place for | |||
471 | initialization code. | 471 | initialization code. |
472 | 472 | ||
473 | void destroy(struct cgroup *cont) | 473 | void destroy(struct cgroup *cont) |
474 | LL=cgroup_mutex | 474 | (cgroup_mutex held by caller) |
475 | 475 | ||
476 | The cgroup system is about to destroy the passed cgroup; the | 476 | The cgroup system is about to destroy the passed cgroup; the subsystem |
477 | subsystem should do any necessary cleanup | 477 | should do any necessary cleanup and free its subsystem state |
478 | object. By the time this method is called, the cgroup has already been | ||
479 | unlinked from the file system and from the child list of its parent; | ||
480 | cgroup->parent is still valid. (Note - can also be called for a | ||
481 | newly-created cgroup if an error occurs after this subsystem's | ||
482 | create() method has been called for the new cgroup). | ||
478 | 483 | ||
479 | int can_attach(struct cgroup_subsys *ss, struct cgroup *cont, | 484 | int can_attach(struct cgroup_subsys *ss, struct cgroup *cont, |
480 | struct task_struct *task) | 485 | struct task_struct *task) |
481 | LL=cgroup_mutex | 486 | (cgroup_mutex held by caller) |
482 | 487 | ||
483 | Called prior to moving a task into a cgroup; if the subsystem | 488 | Called prior to moving a task into a cgroup; if the subsystem |
484 | returns an error, this will abort the attach operation. If a NULL | 489 | returns an error, this will abort the attach operation. If a NULL |
@@ -489,25 +494,20 @@ remain valid while the caller holds cgroup_mutex. | |||
489 | 494 | ||
490 | void attach(struct cgroup_subsys *ss, struct cgroup *cont, | 495 | void attach(struct cgroup_subsys *ss, struct cgroup *cont, |
491 | struct cgroup *old_cont, struct task_struct *task) | 496 | struct cgroup *old_cont, struct task_struct *task) |
492 | LL=cgroup_mutex | ||
493 | |||
494 | 497 | ||
495 | Called after the task has been attached to the cgroup, to allow any | 498 | Called after the task has been attached to the cgroup, to allow any |
496 | post-attachment activity that requires memory allocations or blocking. | 499 | post-attachment activity that requires memory allocations or blocking. |
497 | 500 | ||
498 | void fork(struct cgroup_subsy *ss, struct task_struct *task) | 501 | void fork(struct cgroup_subsy *ss, struct task_struct *task) |
499 | LL=callback_mutex, maybe read_lock(tasklist_lock) | ||
500 | 502 | ||
501 | Called when a task is forked into a cgroup. Also called during | 503 | Called when a task is forked into a cgroup. Also called during |
502 | registration for all existing tasks. | 504 | registration for all existing tasks. |
503 | 505 | ||
504 | void exit(struct cgroup_subsys *ss, struct task_struct *task) | 506 | void exit(struct cgroup_subsys *ss, struct task_struct *task) |
505 | LL=callback_mutex | ||
506 | 507 | ||
507 | Called during task exit | 508 | Called during task exit |
508 | 509 | ||
509 | int populate(struct cgroup_subsys *ss, struct cgroup *cont) | 510 | int populate(struct cgroup_subsys *ss, struct cgroup *cont) |
510 | LL=none | ||
511 | 511 | ||
512 | Called after creation of a cgroup to allow a subsystem to populate | 512 | Called after creation of a cgroup to allow a subsystem to populate |
513 | the cgroup directory with file entries. The subsystem should make | 513 | the cgroup directory with file entries. The subsystem should make |
@@ -524,7 +524,7 @@ example in cpusets, no task may attach before 'cpus' and 'mems' are set | |||
524 | up. | 524 | up. |
525 | 525 | ||
526 | void bind(struct cgroup_subsys *ss, struct cgroup *root) | 526 | void bind(struct cgroup_subsys *ss, struct cgroup *root) |
527 | LL=callback_mutex | 527 | (cgroup_mutex held by caller) |
528 | 528 | ||
529 | Called when a cgroup subsystem is rebound to a different hierarchy | 529 | Called when a cgroup subsystem is rebound to a different hierarchy |
530 | and root cgroup. Currently this will only involve movement between | 530 | and root cgroup. Currently this will only involve movement between |