linux/Documentation
Paul Menage 999cd8a450 cgroups: add a per-subsystem hierarchy_mutex
These patches introduce new locking/refcount support for cgroups to
reduce the need for subsystems to call cgroup_lock(). This will
ultimately allow the atomicity of cgroup_rmdir() (which was removed
recently) to be restored.

These three patches give:

1/3 - introduce a per-subsystem hierarchy_mutex which a subsystem can
     use to prevent changes to its own cgroup tree

2/3 - use hierarchy_mutex in place of calling cgroup_lock() in the
     memory controller

3/3 - introduce a css_tryget() function similar to the one recently
      proposed by Kamezawa, but avoiding spurious refcount failures in
      the event of a race between a css_tryget() and an unsuccessful
      cgroup_rmdir()

Future patches will likely involve:

- using hierarchy mutex in place of cgroup_lock() in more subsystems
 where appropriate

- restoring the atomicity of cgroup_rmdir() with respect to cgroup_create()

This patch:

Add a hierarchy_mutex to the cgroup_subsys object that protects changes to
the hierarchy observed by that subsystem.  It is taken by the cgroup
subsystem (in addition to cgroup_mutex) for the following operations:

- linking a cgroup into that subsystem's cgroup tree
- unlinking a cgroup from that subsystem's cgroup tree
- moving the subsystem to/from a hierarchy (including across the
  bind() callback)

Thus if the subsystem holds its own hierarchy_mutex, it can safely
traverse its own hierarchy.

Signed-off-by: Paul Menage <menage@google.com>
Tested-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-08 08:31:10 -08:00
..
2008-10-30 11:38:45 -07:00
2008-10-30 11:38:45 -07:00
2008-10-30 11:38:45 -07:00
2007-07-19 10:04:47 -07:00
2008-02-14 00:16:13 -05:00
2008-10-16 11:21:30 -07:00
2008-01-11 08:16:14 +11:00
2008-04-25 13:27:03 +01:00
2008-02-03 15:54:28 +02:00
2008-10-30 15:55:47 +01:00
2008-10-30 11:38:45 -07:00
2009-01-06 17:21:00 +01:00
2008-10-30 11:38:47 -07:00
2008-10-29 15:03:50 -07:00
2008-01-11 18:22:30 -06:00
2007-05-09 08:57:56 +02:00
2008-10-30 11:38:45 -07:00
2008-10-16 11:21:29 -07:00
2008-04-29 02:49:47 -04:00
2006-11-30 04:58:40 +01:00
2009-01-06 15:59:03 -08:00
2008-11-12 17:17:18 -08:00
2008-10-30 11:38:45 -07:00
2008-07-25 10:53:30 -07:00
2008-11-12 17:17:18 -08:00
2007-10-19 11:53:34 -07:00
2008-11-14 10:39:26 +11:00
2006-11-30 04:58:40 +01:00
2008-11-28 13:15:14 +01:00
2008-10-16 11:21:40 -07:00
2008-03-24 19:22:19 -07:00
2007-10-18 14:37:32 -07:00
2008-02-06 10:41:09 -08:00
2008-10-20 15:43:10 +02:00
2008-08-12 16:07:30 -07:00
2008-07-21 14:22:18 +10:00
2008-11-12 17:17:17 -08:00
2007-02-11 10:51:35 -08:00
2006-06-27 17:32:47 -07:00
2008-02-06 10:41:14 -08:00
2007-10-17 08:43:06 -07:00