From 9fd4c310a187bf6c25ab34a8e441c8e333718fd0 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Thu, 17 Apr 2008 11:37:15 +0800 Subject: [PATCH] --- yaml --- r: 88394 b: refs/heads/master c: 0e04388f0189fa1f6812a8e1cb6172136eada87e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/cgroup.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index e369fcac4e05..cd4bb3b28482 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4b119e21d0c66c22e8ca03df05d9de623d0eb50f +refs/heads/master: 0e04388f0189fa1f6812a8e1cb6172136eada87e diff --git a/trunk/kernel/cgroup.c b/trunk/kernel/cgroup.c index 2727f9238359..6d8de051382b 100644 --- a/trunk/kernel/cgroup.c +++ b/trunk/kernel/cgroup.c @@ -1722,7 +1722,12 @@ void cgroup_enable_task_cg_lists(void) use_task_css_set_links = 1; do_each_thread(g, p) { task_lock(p); - if (list_empty(&p->cg_list)) + /* + * We should check if the process is exiting, otherwise + * it will race with cgroup_exit() in that the list + * entry won't be deleted though the process has exited. + */ + if (!(p->flags & PF_EXITING) && list_empty(&p->cg_list)) list_add(&p->cg_list, &p->cgroups->tasks); task_unlock(p); } while_each_thread(g, p);