summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-07-01 10:28:42 +0200
committerIngo Molnar <mingo@elte.hu>2011-07-01 10:28:46 +0200
commit10e6962765f8213941eaa1cbb9de425ff0689e2e (patch)
treec277e4ac5b2b7156152454578c39e90da5127dd8 /kernel/exit.c
parentaf07ce3e77d3b24ab1d71fcc5833d41800f23b2b (diff)
parentb0af8dfdd67699e25083478c63eedef2e72ebd85 (diff)
downloadop-kernel-dev-10e6962765f8213941eaa1cbb9de425ff0689e2e.zip
op-kernel-dev-10e6962765f8213941eaa1cbb9de425ff0689e2e.tar.gz
Merge commit 'v3.0-rc5' into perf/core
Merge reason: Pick up the latest fixes. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 20a4064..f2b321b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -561,29 +561,28 @@ void exit_files(struct task_struct *tsk)
#ifdef CONFIG_MM_OWNER
/*
- * Task p is exiting and it owned mm, lets find a new owner for it
+ * A task is exiting. If it owned this mm, find a new owner for the mm.
*/
-static inline int
-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 (atomic_read(&mm->mm_users) <= 1)
- return 0;
- if (mm->owner != p)
- return 0;
- return 1;
-}
-
void mm_update_next_owner(struct mm_struct *mm)
{
struct task_struct *c, *g, *p = current;
retry:
- if (!mm_need_new_owner(mm, p))
+ /*
+ * If the exiting or execing task is not the owner, it's
+ * someone else's problem.
+ */
+ if (mm->owner != p)
return;
+ /*
+ * The current owner is exiting/execing and there are no other
+ * candidates. Do not leave the mm pointing to a possibly
+ * freed task structure.
+ */
+ if (atomic_read(&mm->mm_users) <= 1) {
+ mm->owner = NULL;
+ return;
+ }
read_lock(&tasklist_lock);
/*
OpenPOWER on IntegriCloud