From: Pavel Emelyanov Date: Thu, 20 Mar 2008 00:00:45 +0000 (-0700) Subject: memcgroup: fix check for thread being a group leader in memcgroup X-Git-Tag: v2.6.25-rc7~91 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52ea27eb4cd5f250f33638029a134ff03c5e6bbb;p=linux-2.6 memcgroup: fix check for thread being a group leader in memcgroup The check t->pid == t->pid is not the blessed way to check whether a task is a group leader. This is not about the code beautifulness only, but about pid namespaces fixes - both the tgid and the pid fields on the task_struct are (slowly :( ) becoming deprecated. Besides, the thread_group_leader() macro makes only one dereference :) Signed-off-by: Pavel Emelyanov Cc: Balbir Singh Cc: KAMEZAWA Hiroyuki Cc: Paul Menage Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8b9f6cae93..9b648bd634 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1079,7 +1079,7 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, * Only thread group leaders are allowed to migrate, the mm_struct is * in effect owned by the leader */ - if (p->tgid != p->pid) + if (!thread_group_leader(p)) goto out; css_get(&mem->css);