aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/cgroup.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2727f9238359..6d8de051382b 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1722,7 +1722,12 @@ void cgroup_enable_task_cg_lists(void)
1722 use_task_css_set_links = 1; 1722 use_task_css_set_links = 1;
1723 do_each_thread(g, p) { 1723 do_each_thread(g, p) {
1724 task_lock(p); 1724 task_lock(p);
1725 if (list_empty(&p->cg_list)) 1725 /*
1726 * We should check if the process is exiting, otherwise
1727 * it will race with cgroup_exit() in that the list
1728 * entry won't be deleted though the process has exited.
1729 */
1730 if (!(p->flags & PF_EXITING) && list_empty(&p->cg_list))
1726 list_add(&p->cg_list, &p->cgroups->tasks); 1731 list_add(&p->cg_list, &p->cgroups->tasks);
1727 task_unlock(p); 1732 task_unlock(p);
1728 } while_each_thread(g, p); 1733 } while_each_thread(g, p);