Commit 184faf32 authored by Tejun Heo's avatar Tejun Heo

cgroup: use CSS_ONLINE instead of CGRP_DEAD

Use CSS_ONLINE on the self css to indicate whether a cgroup has been
killed instead of CGRP_DEAD.  This will allow re-using css online test
for cgroup liveliness test.  This doesn't introduce any functional
change.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
parent c2931b70
...@@ -143,8 +143,6 @@ static inline void css_put(struct cgroup_subsys_state *css) ...@@ -143,8 +143,6 @@ static inline void css_put(struct cgroup_subsys_state *css)
/* bits in struct cgroup flags field */ /* bits in struct cgroup flags field */
enum { enum {
/* Control Group is dead */
CGRP_DEAD,
/* /*
* Control Group has previously had a child cgroup or a task, * Control Group has previously had a child cgroup or a task,
* but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
......
...@@ -278,7 +278,7 @@ static struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp, ...@@ -278,7 +278,7 @@ static struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp,
/* convenient tests for these bits */ /* convenient tests for these bits */
static inline bool cgroup_is_dead(const struct cgroup *cgrp) static inline bool cgroup_is_dead(const struct cgroup *cgrp)
{ {
return test_bit(CGRP_DEAD, &cgrp->flags); return !(cgrp->self.flags & CSS_ONLINE);
} }
struct cgroup_subsys_state *of_css(struct kernfs_open_file *of) struct cgroup_subsys_state *of_css(struct kernfs_open_file *of)
...@@ -1518,6 +1518,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp) ...@@ -1518,6 +1518,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
INIT_LIST_HEAD(&cgrp->pidlists); INIT_LIST_HEAD(&cgrp->pidlists);
mutex_init(&cgrp->pidlist_mutex); mutex_init(&cgrp->pidlist_mutex);
cgrp->self.cgroup = cgrp; cgrp->self.cgroup = cgrp;
cgrp->self.flags |= CSS_ONLINE;
for_each_subsys(ss, ssid) for_each_subsys(ss, ssid)
INIT_LIST_HEAD(&cgrp->e_csets[ssid]); INIT_LIST_HEAD(&cgrp->e_csets[ssid]);
...@@ -4541,13 +4542,13 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) ...@@ -4541,13 +4542,13 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
* Mark @cgrp dead. This prevents further task migration and child * Mark @cgrp dead. This prevents further task migration and child
* creation by disabling cgroup_lock_live_group(). * creation by disabling cgroup_lock_live_group().
*/ */
set_bit(CGRP_DEAD, &cgrp->flags); cgrp->self.flags &= ~CSS_ONLINE;
/* initiate massacre of all css's */ /* initiate massacre of all css's */
for_each_css(css, ssid, cgrp) for_each_css(css, ssid, cgrp)
kill_css(css); kill_css(css);
/* CGRP_DEAD is set, remove from ->release_list for the last time */ /* CSS_ONLINE is clear, remove from ->release_list for the last time */
raw_spin_lock(&release_list_lock); raw_spin_lock(&release_list_lock);
if (!list_empty(&cgrp->release_list)) if (!list_empty(&cgrp->release_list))
list_del_init(&cgrp->release_list); list_del_init(&cgrp->release_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment