aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2016-03-03 09:57:57 -0500
committerTejun Heo <tj@kernel.org>2016-03-03 09:57:57 -0500
commit20b454a61fba59be13de52b4493898583ea26d20 (patch)
tree5ca01cf119f13dbd501886cecd917f0705382d96 /kernel/cgroup.c
parentcgroup: re-hash init_css_set after subsystems are initialized (diff)
downloadlinux-dev-20b454a61fba59be13de52b4493898583ea26d20.tar.xz
linux-dev-20b454a61fba59be13de52b4493898583ea26d20.zip
cgroup: suppress spurious de-populated events
During task migration, tasks may transfer between two css_sets which are associated with the same cgroup. If those tasks are the only tasks in the cgroup, this currently triggers a spurious de-populated event on the cgroup. Fix it by bumping up populated count before bumping it down during migration to ensure that it doesn't reach zero spuriously. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e97772b42dfb..5d452e7fcb4f 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -678,6 +678,9 @@ static void css_set_move_task(struct task_struct *task,
{
lockdep_assert_held(&css_set_lock);
+ if (to_cset && !css_set_populated(to_cset))
+ css_set_update_populated(to_cset, true);
+
if (from_cset) {
struct css_task_iter *it, *pos;
@@ -711,8 +714,6 @@ static void css_set_move_task(struct task_struct *task,
*/
WARN_ON_ONCE(task->flags & PF_EXITING);
- if (!css_set_populated(to_cset))
- css_set_update_populated(to_cset, true);
rcu_assign_pointer(task->cgroups, to_cset);
list_add_tail(&task->cg_list, use_mg_tasks ? &to_cset->mg_tasks :
&to_cset->tasks);