diff options
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 7b71f87f1207..80137a5d9467 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -113,8 +113,6 @@ static void __exit_signal(struct task_struct *tsk) | |||
113 | * We won't ever get here for the group leader, since it | 113 | * We won't ever get here for the group leader, since it |
114 | * will have been the last reference on the signal_struct. | 114 | * will have been the last reference on the signal_struct. |
115 | */ | 115 | */ |
116 | sig->utime = cputime_add(sig->utime, task_utime(tsk)); | ||
117 | sig->stime = cputime_add(sig->stime, task_stime(tsk)); | ||
118 | sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); | 116 | sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); |
119 | sig->min_flt += tsk->min_flt; | 117 | sig->min_flt += tsk->min_flt; |
120 | sig->maj_flt += tsk->maj_flt; | 118 | sig->maj_flt += tsk->maj_flt; |
@@ -123,7 +121,6 @@ static void __exit_signal(struct task_struct *tsk) | |||
123 | sig->inblock += task_io_get_inblock(tsk); | 121 | sig->inblock += task_io_get_inblock(tsk); |
124 | sig->oublock += task_io_get_oublock(tsk); | 122 | sig->oublock += task_io_get_oublock(tsk); |
125 | task_io_accounting_add(&sig->ioac, &tsk->ioac); | 123 | task_io_accounting_add(&sig->ioac, &tsk->ioac); |
126 | sig->sum_sched_runtime += tsk->se.sum_exec_runtime; | ||
127 | sig = NULL; /* Marker for below. */ | 124 | sig = NULL; /* Marker for below. */ |
128 | } | 125 | } |
129 | 126 | ||
@@ -644,24 +641,23 @@ retry: | |||
644 | assign_new_owner: | 641 | assign_new_owner: |
645 | BUG_ON(c == p); | 642 | BUG_ON(c == p); |
646 | get_task_struct(c); | 643 | get_task_struct(c); |
644 | read_unlock(&tasklist_lock); | ||
645 | down_write(&mm->mmap_sem); | ||
647 | /* | 646 | /* |
648 | * The task_lock protects c->mm from changing. | 647 | * The task_lock protects c->mm from changing. |
649 | * We always want mm->owner->mm == mm | 648 | * We always want mm->owner->mm == mm |
650 | */ | 649 | */ |
651 | task_lock(c); | 650 | task_lock(c); |
652 | /* | ||
653 | * Delay read_unlock() till we have the task_lock() | ||
654 | * to ensure that c does not slip away underneath us | ||
655 | */ | ||
656 | read_unlock(&tasklist_lock); | ||
657 | if (c->mm != mm) { | 651 | if (c->mm != mm) { |
658 | task_unlock(c); | 652 | task_unlock(c); |
653 | up_write(&mm->mmap_sem); | ||
659 | put_task_struct(c); | 654 | put_task_struct(c); |
660 | goto retry; | 655 | goto retry; |
661 | } | 656 | } |
662 | cgroup_mm_owner_callbacks(mm->owner, c); | 657 | cgroup_mm_owner_callbacks(mm->owner, c); |
663 | mm->owner = c; | 658 | mm->owner = c; |
664 | task_unlock(c); | 659 | task_unlock(c); |
660 | up_write(&mm->mmap_sem); | ||
665 | put_task_struct(c); | 661 | put_task_struct(c); |
666 | } | 662 | } |
667 | #endif /* CONFIG_MM_OWNER */ | 663 | #endif /* CONFIG_MM_OWNER */ |
@@ -1308,6 +1304,7 @@ static int wait_task_zombie(struct task_struct *p, int options, | |||
1308 | if (likely(!traced)) { | 1304 | if (likely(!traced)) { |
1309 | struct signal_struct *psig; | 1305 | struct signal_struct *psig; |
1310 | struct signal_struct *sig; | 1306 | struct signal_struct *sig; |
1307 | struct task_cputime cputime; | ||
1311 | 1308 | ||
1312 | /* | 1309 | /* |
1313 | * The resource counters for the group leader are in its | 1310 | * The resource counters for the group leader are in its |
@@ -1323,20 +1320,23 @@ static int wait_task_zombie(struct task_struct *p, int options, | |||
1323 | * need to protect the access to p->parent->signal fields, | 1320 | * need to protect the access to p->parent->signal fields, |
1324 | * as other threads in the parent group can be right | 1321 | * as other threads in the parent group can be right |
1325 | * here reaping other children at the same time. | 1322 | * here reaping other children at the same time. |
1323 | * | ||
1324 | * We use thread_group_cputime() to get times for the thread | ||
1325 | * group, which consolidates times for all threads in the | ||
1326 | * group including the group leader. | ||
1326 | */ | 1327 | */ |
1327 | spin_lock_irq(&p->parent->sighand->siglock); | 1328 | spin_lock_irq(&p->parent->sighand->siglock); |
1328 | psig = p->parent->signal; | 1329 | psig = p->parent->signal; |
1329 | sig = p->signal; | 1330 | sig = p->signal; |
1331 | thread_group_cputime(p, &cputime); | ||
1330 | psig->cutime = | 1332 | psig->cutime = |
1331 | cputime_add(psig->cutime, | 1333 | cputime_add(psig->cutime, |
1332 | cputime_add(p->utime, | 1334 | cputime_add(cputime.utime, |
1333 | cputime_add(sig->utime, | 1335 | sig->cutime)); |
1334 | sig->cutime))); | ||
1335 | psig->cstime = | 1336 | psig->cstime = |
1336 | cputime_add(psig->cstime, | 1337 | cputime_add(psig->cstime, |
1337 | cputime_add(p->stime, | 1338 | cputime_add(cputime.stime, |
1338 | cputime_add(sig->stime, | 1339 | sig->cstime)); |
1339 | sig->cstime))); | ||
1340 | psig->cgtime = | 1340 | psig->cgtime = |
1341 | cputime_add(psig->cgtime, | 1341 | cputime_add(psig->cgtime, |
1342 | cputime_add(p->gtime, | 1342 | cputime_add(p->gtime, |