summaryrefslogtreecommitdiff
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-06 06:13:18 (GMT)
committerIngo Molnar <mingo@elte.hu>2008-10-06 06:13:18 (GMT)
commit2c10c22af088ab5d94fae93ce3fe6436b2a208b4 (patch)
treedb27721001f194327ddbdcd6c983c4ec68b77c00 /kernel/exit.c
parentf6121f4f8708195e88cbdf8dd8d171b226b3f858 (diff)
parentfec6ed1d1f9b78a6acb4a3eb2c46c812ac2e96f0 (diff)
downloadlinux-fsl-qoriq-2c10c22af088ab5d94fae93ce3fe6436b2a208b4.tar.xz
Merge branch 'linus' into sched/devel
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 1639564..85a83c8 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -583,8 +583,6 @@ mm_need_new_owner(struct mm_struct *mm, struct task_struct *p)
* If there are other users of the mm and the owner (us) is exiting
* we need to find a new owner to take on the responsibility.
*/
- if (!mm)
- return 0;
if (atomic_read(&mm->mm_users) <= 1)
return 0;
if (mm->owner != p)
@@ -627,6 +625,16 @@ retry:
} while_each_thread(g, c);
read_unlock(&tasklist_lock);
+ /*
+ * We found no owner yet mm_users > 1: this implies that we are
+ * most likely racing with swapoff (try_to_unuse()) or /proc or
+ * ptrace or page migration (get_task_mm()). Mark owner as NULL,
+ * so that subsystems can understand the callback and take action.
+ */
+ down_write(&mm->mmap_sem);
+ cgroup_mm_owner_callbacks(mm->owner, NULL);
+ mm->owner = NULL;
+ up_write(&mm->mmap_sem);
return;
assign_new_owner: