Skip to content

Commit

Permalink
cgroup: suppress spurious de-populated events
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Zefan Li <[email protected]>
  • Loading branch information
htejun committed Mar 3, 2016
1 parent 2378d8b commit 20b454a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 20b454a

Please sign in to comment.