Skip to content

Commit

Permalink
memcgroup: fix check for thread being a group leader in memcgroup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Balbir Singh <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Paul Menage <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xemul authored and torvalds committed Mar 20, 2008
1 parent 0cf01f6 commit 52ea27e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 52ea27e

Please sign in to comment.