aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-10 20:42:53 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-10 20:42:53 -0500
commit506c10f26c481b7f8ef27c1c79290f68989b2e9e (patch)
tree03de82e812f00957aa6276dac2fe51c3358e88d7 /kernel/exit.c
parente1df957670aef74ffd9a4ad93e6d2c90bf6b4845 (diff)
parentc59765042f53a79a7a65585042ff463b69cb248c (diff)
Merge commit 'v2.6.29-rc1' into perfcounters/core
Conflicts: include/linux/kernel_stat.h
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index ad8d04d83a2e..cbdb39a498eb 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -645,35 +645,31 @@ retry:
645 /* 645 /*
646 * We found no owner yet mm_users > 1: this implies that we are 646 * We found no owner yet mm_users > 1: this implies that we are
647 * most likely racing with swapoff (try_to_unuse()) or /proc or 647 * most likely racing with swapoff (try_to_unuse()) or /proc or
648 * ptrace or page migration (get_task_mm()). Mark owner as NULL, 648 * ptrace or page migration (get_task_mm()). Mark owner as NULL.
649 * so that subsystems can understand the callback and take action.
650 */ 649 */
651 down_write(&mm->mmap_sem);
652 cgroup_mm_owner_callbacks(mm->owner, NULL);
653 mm->owner = NULL; 650 mm->owner = NULL;
654 up_write(&mm->mmap_sem);
655 return; 651 return;
656 652
657assign_new_owner: 653assign_new_owner:
658 BUG_ON(c == p); 654 BUG_ON(c == p);
659 get_task_struct(c); 655 get_task_struct(c);
660 read_unlock(&tasklist_lock);
661 down_write(&mm->mmap_sem);
662 /* 656 /*
663 * The task_lock protects c->mm from changing. 657 * The task_lock protects c->mm from changing.
664 * We always want mm->owner->mm == mm 658 * We always want mm->owner->mm == mm
665 */ 659 */
666 task_lock(c); 660 task_lock(c);
661 /*
662 * Delay read_unlock() till we have the task_lock()
663 * to ensure that c does not slip away underneath us
664 */
665 read_unlock(&tasklist_lock);
667 if (c->mm != mm) { 666 if (c->mm != mm) {
668 task_unlock(c); 667 task_unlock(c);
669 up_write(&mm->mmap_sem);
670 put_task_struct(c); 668 put_task_struct(c);
671 goto retry; 669 goto retry;
672 } 670 }
673 cgroup_mm_owner_callbacks(mm->owner, c);
674 mm->owner = c; 671 mm->owner = c;
675 task_unlock(c); 672 task_unlock(c);
676 up_write(&mm->mmap_sem);
677 put_task_struct(c); 673 put_task_struct(c);
678} 674}
679#endif /* CONFIG_MM_OWNER */ 675#endif /* CONFIG_MM_OWNER */
@@ -1040,8 +1036,6 @@ NORET_TYPE void do_exit(long code)
1040 * task into the wait for ever nirwana as well. 1036 * task into the wait for ever nirwana as well.
1041 */ 1037 */
1042 tsk->flags |= PF_EXITPIDONE; 1038 tsk->flags |= PF_EXITPIDONE;
1043 if (tsk->io_context)
1044 exit_io_context();
1045 set_current_state(TASK_UNINTERRUPTIBLE); 1039 set_current_state(TASK_UNINTERRUPTIBLE);
1046 schedule(); 1040 schedule();
1047 } 1041 }
@@ -1060,10 +1054,7 @@ NORET_TYPE void do_exit(long code)
1060 preempt_count()); 1054 preempt_count());
1061 1055
1062 acct_update_integrals(tsk); 1056 acct_update_integrals(tsk);
1063 if (tsk->mm) { 1057
1064 update_hiwater_rss(tsk->mm);
1065 update_hiwater_vm(tsk->mm);
1066 }
1067 group_dead = atomic_dec_and_test(&tsk->signal->live); 1058 group_dead = atomic_dec_and_test(&tsk->signal->live);
1068 if (group_dead) { 1059 if (group_dead) {
1069 hrtimer_cancel(&tsk->signal->real_timer); 1060 hrtimer_cancel(&tsk->signal->real_timer);
@@ -1327,10 +1318,10 @@ static int wait_task_zombie(struct task_struct *p, int options,
1327 * group, which consolidates times for all threads in the 1318 * group, which consolidates times for all threads in the
1328 * group including the group leader. 1319 * group including the group leader.
1329 */ 1320 */
1321 thread_group_cputime(p, &cputime);
1330 spin_lock_irq(&p->parent->sighand->siglock); 1322 spin_lock_irq(&p->parent->sighand->siglock);
1331 psig = p->parent->signal; 1323 psig = p->parent->signal;
1332 sig = p->signal; 1324 sig = p->signal;
1333 thread_group_cputime(p, &cputime);
1334 psig->cutime = 1325 psig->cutime =
1335 cputime_add(psig->cutime, 1326 cputime_add(psig->cutime,
1336 cputime_add(cputime.utime, 1327 cputime_add(cputime.utime,