summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-25 09:16:12 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-25 09:16:12 -0700
commit889e5528cbe7dff2e91caf48f4bb23c17748b984 (patch)
treeaf66c15b48efb49926c475bbb4f33f48e1a76c40 /kernel/cgroup.c
parentff446f2001cf9b5ed97c6256c4ee3549d3b7abed (diff)
parent6b16351acbd415e66ba16bf7d473ece1574cf0bc (diff)
downloadtalos-op-linux-889e5528cbe7dff2e91caf48f4bb23c17748b984.tar.gz
talos-op-linux-889e5528cbe7dff2e91caf48f4bb23c17748b984.zip
Merge 3.5-rc4 into usb-next
This is to get the USB fixes that were merged in the 3.5-rc4 tree into usb-next so that everyone can sync up properly. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 72fcd3069a90..2097684cf194 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -255,12 +255,17 @@ int cgroup_lock_is_held(void)
EXPORT_SYMBOL_GPL(cgroup_lock_is_held);
+static int css_unbias_refcnt(int refcnt)
+{
+ return refcnt >= 0 ? refcnt : refcnt - CSS_DEACT_BIAS;
+}
+
/* the current nr of refs, always >= 0 whether @css is deactivated or not */
static int css_refcnt(struct cgroup_subsys_state *css)
{
int v = atomic_read(&css->refcnt);
- return v >= 0 ? v : v - CSS_DEACT_BIAS;
+ return css_unbias_refcnt(v);
}
/* convenient tests for these bits */
@@ -4982,10 +4987,12 @@ EXPORT_SYMBOL_GPL(__css_tryget);
void __css_put(struct cgroup_subsys_state *css)
{
struct cgroup *cgrp = css->cgroup;
+ int v;
rcu_read_lock();
- atomic_dec(&css->refcnt);
- switch (css_refcnt(css)) {
+ v = css_unbias_refcnt(atomic_dec_return(&css->refcnt));
+
+ switch (v) {
case 1:
if (notify_on_release(cgrp)) {
set_bit(CGRP_RELEASABLE, &cgrp->flags);
OpenPOWER on IntegriCloud