aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 0ef4673e351b..80137a5d9467 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -47,6 +47,7 @@
47#include <linux/blkdev.h> 47#include <linux/blkdev.h>
48#include <linux/task_io_accounting_ops.h> 48#include <linux/task_io_accounting_ops.h>
49#include <linux/tracehook.h> 49#include <linux/tracehook.h>
50#include <trace/sched.h>
50 51
51#include <asm/uaccess.h> 52#include <asm/uaccess.h>
52#include <asm/unistd.h> 53#include <asm/unistd.h>
@@ -112,8 +113,6 @@ static void __exit_signal(struct task_struct *tsk)
112 * 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
113 * will have been the last reference on the signal_struct. 114 * will have been the last reference on the signal_struct.
114 */ 115 */
115 sig->utime = cputime_add(sig->utime, task_utime(tsk));
116 sig->stime = cputime_add(sig->stime, task_stime(tsk));
117 sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); 116 sig->gtime = cputime_add(sig->gtime, task_gtime(tsk));
118 sig->min_flt += tsk->min_flt; 117 sig->min_flt += tsk->min_flt;
119 sig->maj_flt += tsk->maj_flt; 118 sig->maj_flt += tsk->maj_flt;
@@ -122,7 +121,6 @@ static void __exit_signal(struct task_struct *tsk)
122 sig->inblock += task_io_get_inblock(tsk); 121 sig->inblock += task_io_get_inblock(tsk);
123 sig->oublock += task_io_get_oublock(tsk); 122 sig->oublock += task_io_get_oublock(tsk);
124 task_io_accounting_add(&sig->ioac, &tsk->ioac); 123 task_io_accounting_add(&sig->ioac, &tsk->ioac);
125 sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
126 sig = NULL; /* Marker for below. */ 124 sig = NULL; /* Marker for below. */
127 } 125 }
128 126
@@ -149,7 +147,10 @@ static void __exit_signal(struct task_struct *tsk)
149 147
150static void delayed_put_task_struct(struct rcu_head *rhp) 148static void delayed_put_task_struct(struct rcu_head *rhp)
151{ 149{
152 put_task_struct(container_of(rhp, struct task_struct, rcu)); 150 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
151
152 trace_sched_process_free(tsk);
153 put_task_struct(tsk);
153} 154}
154 155
155 156
@@ -1073,6 +1074,8 @@ NORET_TYPE void do_exit(long code)
1073 1074
1074 if (group_dead) 1075 if (group_dead)
1075 acct_process(); 1076 acct_process();
1077 trace_sched_process_exit(tsk);
1078
1076 exit_sem(tsk); 1079 exit_sem(tsk);
1077 exit_files(tsk); 1080 exit_files(tsk);
1078 exit_fs(tsk); 1081 exit_fs(tsk);
@@ -1301,6 +1304,7 @@ static int wait_task_zombie(struct task_struct *p, int options,
1301 if (likely(!traced)) { 1304 if (likely(!traced)) {
1302 struct signal_struct *psig; 1305 struct signal_struct *psig;
1303 struct signal_struct *sig; 1306 struct signal_struct *sig;
1307 struct task_cputime cputime;
1304 1308
1305 /* 1309 /*
1306 * The resource counters for the group leader are in its 1310 * The resource counters for the group leader are in its
@@ -1316,20 +1320,23 @@ static int wait_task_zombie(struct task_struct *p, int options,
1316 * need to protect the access to p->parent->signal fields, 1320 * need to protect the access to p->parent->signal fields,
1317 * as other threads in the parent group can be right 1321 * as other threads in the parent group can be right
1318 * 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.
1319 */ 1327 */
1320 spin_lock_irq(&p->parent->sighand->siglock); 1328 spin_lock_irq(&p->parent->sighand->siglock);
1321 psig = p->parent->signal; 1329 psig = p->parent->signal;
1322 sig = p->signal; 1330 sig = p->signal;
1331 thread_group_cputime(p, &cputime);
1323 psig->cutime = 1332 psig->cutime =
1324 cputime_add(psig->cutime, 1333 cputime_add(psig->cutime,
1325 cputime_add(p->utime, 1334 cputime_add(cputime.utime,
1326 cputime_add(sig->utime, 1335 sig->cutime));
1327 sig->cutime)));
1328 psig->cstime = 1336 psig->cstime =
1329 cputime_add(psig->cstime, 1337 cputime_add(psig->cstime,
1330 cputime_add(p->stime, 1338 cputime_add(cputime.stime,
1331 cputime_add(sig->stime, 1339 sig->cstime));
1332 sig->cstime)));
1333 psig->cgtime = 1340 psig->cgtime =
1334 cputime_add(psig->cgtime, 1341 cputime_add(psig->cgtime,
1335 cputime_add(p->gtime, 1342 cputime_add(p->gtime,
@@ -1674,6 +1681,8 @@ static long do_wait(enum pid_type type, struct pid *pid, int options,
1674 struct task_struct *tsk; 1681 struct task_struct *tsk;
1675 int retval; 1682 int retval;
1676 1683
1684 trace_sched_process_wait(pid);
1685
1677 add_wait_queue(&current->signal->wait_chldexit,&wait); 1686 add_wait_queue(&current->signal->wait_chldexit,&wait);
1678repeat: 1687repeat:
1679 /* 1688 /*