aboutsummaryrefslogtreecommitdiff
path: root/crypto/sha1_generic.c
diff options
context:
space:
mode:
authorPaul Menage <menage@google.com>2009-01-07 18:08:38 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 08:31:10 -0800
commite7c5ec9193d32b9559a3bb8893ceedbda85201ff (patch)
treefd7505c03e2c7525a110a702907c0604c233e2d9 /crypto/sha1_generic.c
parent2cb378c862777d050c20db903b119a029845fdcb (diff)
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 'crypto/sha1_generic.c')
0 files changed, 0 insertions, 0 deletions