Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114685
b: refs/heads/master
c: 9363b9f
h: refs/heads/master
i:
  114683: 1b8e6b5
v: v3
  • Loading branch information
Balbir Singh authored and Linus Torvalds committed Oct 16, 2008
1 parent bb9936a commit f260492
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1648993fb05c487947c1cec6307aca29d8002abe
refs/heads/master: 9363b9f23c9cc36cc8ef6c05fdf879ee4a96ae92
3 changes: 2 additions & 1 deletion trunk/include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ struct cgroup_subsys {
*/
void (*mm_owner_changed)(struct cgroup_subsys *ss,
struct cgroup *old,
struct cgroup *new);
struct cgroup *new,
struct task_struct *p);
int subsys_id;
int active;
int disabled;
Expand Down
4 changes: 3 additions & 1 deletion trunk/kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,8 @@ void cgroup_fork_callbacks(struct task_struct *child)
* Called on every change to mm->owner. mm_init_owner() does not
* invoke this routine, since it assigns the mm->owner the first time
* and does not change it.
*
* The callbacks are invoked with mmap_sem held in read mode.
*/
void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
{
Expand All @@ -2750,7 +2752,7 @@ void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
if (oldcgrp == newcgrp)
continue;
if (ss->mm_owner_changed)
ss->mm_owner_changed(ss, oldcgrp, newcgrp);
ss->mm_owner_changed(ss, oldcgrp, newcgrp, new);
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,24 +640,23 @@ void mm_update_next_owner(struct mm_struct *mm)
assign_new_owner:
BUG_ON(c == p);
get_task_struct(c);
read_unlock(&tasklist_lock);
down_write(&mm->mmap_sem);
/*
* The task_lock protects c->mm from changing.
* We always want mm->owner->mm == mm
*/
task_lock(c);
/*
* Delay read_unlock() till we have the task_lock()
* to ensure that c does not slip away underneath us
*/
read_unlock(&tasklist_lock);
if (c->mm != mm) {
task_unlock(c);
up_write(&mm->mmap_sem);
put_task_struct(c);
goto retry;
}
cgroup_mm_owner_callbacks(mm->owner, c);
mm->owner = c;
task_unlock(c);
up_write(&mm->mmap_sem);
put_task_struct(c);
}
#endif /* CONFIG_MM_OWNER */
Expand Down

0 comments on commit f260492

Please sign in to comment.