aboutsummaryrefslogtreecommitdiff
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-10-12 15:44:33 +0200
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-10-12 15:44:33 +0200
commit0d62950125241a6e6db8e8f14271f098ec7a2da4 (patch)
tree8cdd9e17f6a6ff4cb6166ad12a4d3ed1d45b2dc9 /kernel/exit.c
parentb3bc2c5562f06ca34b30f61c5714e96490946c81 (diff)
parent5e7184ae0dd49456387e8b1cdebc6b2c92fc6d51 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/atmel-mci-2.6.28
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 16395644a98..85a83c83185 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: