summaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorPaul Menage2009-01-08 03:08:38 +0100
committerLinus Torvalds2009-01-08 17:31:10 +0100
commite7c5ec9193d32b9559a3bb8893ceedbda85201ff (patch)
treefd7505c03e2c7525a110a702907c0604c233e2d9 /kernel/cpuset.c
parentcgroups: use hierarchy_mutex in memory controller (diff)
downloadkernel-qcow2-linux-e7c5ec9193d32b9559a3bb8893ceedbda85201ff.tar.gz
kernel-qcow2-linux-e7c5ec9193d32b9559a3bb8893ceedbda85201ff.tar.xz
kernel-qcow2-linux-e7c5ec9193d32b9559a3bb8893ceedbda85201ff.zip
cgroups: add css_tryget()
Add css_tryget(), that obtains a counted reference on a CSS. It is used in situations where the caller has a "weak" reference to the CSS, i.e. one that does not protect the cgroup from removal via a reference count, but would instead be cleaned up by a destroy() callback. css_tryget() will return true on success, or false if the cgroup is being removed. This is similar to Kamezawa Hiroyuki's patch from a week or two ago, but with the difference that in the event of css_tryget() racing with a cgroup_rmdir(), css_tryget() will only return false if the cgroup really does get removed. This implementation is done by biasing css->refcnt, so that a refcnt of 1 means "releasable" and 0 means "released or releasing". In the event of a race, css_tryget() distinguishes between "released" and "releasing" by checking for the CSS_REMOVED flag in css->flags. 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>
Diffstat (limited to 'kernel/cpuset.c')
0 files changed, 0 insertions, 0 deletions