summaryrefslogtreecommitdiffstats
path: root/fs/proc/kcore.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-01 12:09:56 -0700
committerTejun Heo <tj@kernel.org>2012-04-01 12:09:56 -0700
commit28b4c27b8e6bb6d7ff2875281a8484f8898a87ef (patch)
tree8da3eefc6b98c46a4dbd0fd6e6d6dec6220382df /fs/proc/kcore.c
parent79578621b4847afdef48d19a28d00e3b188c37e1 (diff)
downloadop-kernel-dev-28b4c27b8e6bb6d7ff2875281a8484f8898a87ef.zip
op-kernel-dev-28b4c27b8e6bb6d7ff2875281a8484f8898a87ef.tar.gz
cgroup: use negative bias on css->refcnt to block css_tryget()
When a cgroup is about to be removed, cgroup_clear_css_refs() is called to check and ensure that there are no active css references. This is currently achieved by dropping the refcnt to zero iff it has only the base ref. If all css refs could be dropped to zero, ref clearing is successful and CSS_REMOVED is set on all css. If not, the base ref is restored. While css ref is zero w/o CSS_REMOVED set, any css_tryget() attempt on it busy loops so that they are atomic w.r.t. the whole css ref clearing. This does work but dropping and re-instating the base ref is somewhat hairy and makes it difficult to add more logic to the put path as there are two of them - the regular css_put() and the reversible base ref clearing. This patch updates css ref clearing such that blocking new css_tryget() and putting the base ref are separate operations. CSS_DEACT_BIAS, defined as INT_MIN, is added to css->refcnt and css_tryget() busy loops while refcnt is negative. After all css refs are deactivated, if they were all one, ref clearing succeeded and CSS_REMOVED is set and the base ref is put using the regular css_put(); otherwise, CSS_DEACT_BIAS is subtracted from the refcnts and the original postive values are restored. css_refcnt() accessor which always returns the unbiased positive reference counts is added and used to simplify refcnt usages. While at it, relocate and reformat comments in cgroup_has_css_refs(). This separates css->refcnt deactivation and putting the base ref, which enables the next patch to make ref clearing optional. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs/proc/kcore.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud