[lkml]   [2008]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] 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 <>


diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index eb681a6..bc4cac6 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1065,7 +1065,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;


 \ /
  Last update: 2008-03-14 14:47    [W:0.016 / U:52.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site