diff options
Diffstat (limited to 'kernel/exit.c')
| -rw-r--r-- | kernel/exit.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index f7864ac2ecc1..6f50ef55a6f3 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #include <linux/init_task.h> | 49 | #include <linux/init_task.h> |
| 50 | #include <linux/perf_event.h> | 50 | #include <linux/perf_event.h> |
| 51 | #include <trace/events/sched.h> | 51 | #include <trace/events/sched.h> |
| 52 | #include <linux/hw_breakpoint.h> | ||
| 52 | 53 | ||
| 53 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
| 54 | #include <asm/unistd.h> | 55 | #include <asm/unistd.h> |
| @@ -110,9 +111,9 @@ static void __exit_signal(struct task_struct *tsk) | |||
| 110 | * We won't ever get here for the group leader, since it | 111 | * We won't ever get here for the group leader, since it |
| 111 | * will have been the last reference on the signal_struct. | 112 | * will have been the last reference on the signal_struct. |
| 112 | */ | 113 | */ |
| 113 | sig->utime = cputime_add(sig->utime, task_utime(tsk)); | 114 | sig->utime = cputime_add(sig->utime, tsk->utime); |
| 114 | sig->stime = cputime_add(sig->stime, task_stime(tsk)); | 115 | sig->stime = cputime_add(sig->stime, tsk->stime); |
| 115 | sig->gtime = cputime_add(sig->gtime, task_gtime(tsk)); | 116 | sig->gtime = cputime_add(sig->gtime, tsk->gtime); |
| 116 | sig->min_flt += tsk->min_flt; | 117 | sig->min_flt += tsk->min_flt; |
| 117 | sig->maj_flt += tsk->maj_flt; | 118 | sig->maj_flt += tsk->maj_flt; |
| 118 | sig->nvcsw += tsk->nvcsw; | 119 | sig->nvcsw += tsk->nvcsw; |
| @@ -970,7 +971,7 @@ NORET_TYPE void do_exit(long code) | |||
| 970 | exit_thread(); | 971 | exit_thread(); |
| 971 | cgroup_exit(tsk, 1); | 972 | cgroup_exit(tsk, 1); |
| 972 | 973 | ||
| 973 | if (group_dead && tsk->signal->leader) | 974 | if (group_dead) |
| 974 | disassociate_ctty(1); | 975 | disassociate_ctty(1); |
| 975 | 976 | ||
| 976 | module_put(task_thread_info(tsk)->exec_domain->module); | 977 | module_put(task_thread_info(tsk)->exec_domain->module); |
| @@ -978,6 +979,10 @@ NORET_TYPE void do_exit(long code) | |||
| 978 | proc_exit_connector(tsk); | 979 | proc_exit_connector(tsk); |
| 979 | 980 | ||
| 980 | /* | 981 | /* |
| 982 | * FIXME: do that only when needed, using sched_exit tracepoint | ||
| 983 | */ | ||
| 984 | flush_ptrace_hw_breakpoint(tsk); | ||
| 985 | /* | ||
| 981 | * Flush inherited counters to the parent - before the parent | 986 | * Flush inherited counters to the parent - before the parent |
| 982 | * gets woken up by child-exit notifications. | 987 | * gets woken up by child-exit notifications. |
| 983 | */ | 988 | */ |
| @@ -1004,7 +1009,7 @@ NORET_TYPE void do_exit(long code) | |||
| 1004 | tsk->flags |= PF_EXITPIDONE; | 1009 | tsk->flags |= PF_EXITPIDONE; |
| 1005 | 1010 | ||
| 1006 | if (tsk->io_context) | 1011 | if (tsk->io_context) |
| 1007 | exit_io_context(); | 1012 | exit_io_context(tsk); |
| 1008 | 1013 | ||
| 1009 | if (tsk->splice_pipe) | 1014 | if (tsk->splice_pipe) |
| 1010 | __free_pipe_info(tsk->splice_pipe); | 1015 | __free_pipe_info(tsk->splice_pipe); |
| @@ -1205,6 +1210,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) | |||
| 1205 | struct signal_struct *psig; | 1210 | struct signal_struct *psig; |
| 1206 | struct signal_struct *sig; | 1211 | struct signal_struct *sig; |
| 1207 | unsigned long maxrss; | 1212 | unsigned long maxrss; |
| 1213 | cputime_t tgutime, tgstime; | ||
| 1208 | 1214 | ||
| 1209 | /* | 1215 | /* |
| 1210 | * The resource counters for the group leader are in its | 1216 | * The resource counters for the group leader are in its |
| @@ -1220,20 +1226,23 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) | |||
| 1220 | * need to protect the access to parent->signal fields, | 1226 | * need to protect the access to parent->signal fields, |
| 1221 | * as other threads in the parent group can be right | 1227 | * as other threads in the parent group can be right |
| 1222 | * here reaping other children at the same time. | 1228 | * here reaping other children at the same time. |
| 1229 | * | ||
| 1230 | * We use thread_group_times() to get times for the thread | ||
| 1231 | * group, which consolidates times for all threads in the | ||
| 1232 | * group including the group leader. | ||
| 1223 | */ | 1233 | */ |
| 1234 | thread_group_times(p, &tgutime, &tgstime); | ||
| 1224 | spin_lock_irq(&p->real_parent->sighand->siglock); | 1235 | spin_lock_irq(&p->real_parent->sighand->siglock); |
| 1225 | psig = p->real_parent->signal; | 1236 | psig = p->real_parent->signal; |
| 1226 | sig = p->signal; | 1237 | sig = p->signal; |
| 1227 | psig->cutime = | 1238 | psig->cutime = |
| 1228 | cputime_add(psig->cutime, | 1239 | cputime_add(psig->cutime, |
| 1229 | cputime_add(p->utime, | 1240 | cputime_add(tgutime, |
| 1230 | cputime_add(sig->utime, | 1241 | sig->cutime)); |
| 1231 | sig->cutime))); | ||
| 1232 | psig->cstime = | 1242 | psig->cstime = |
| 1233 | cputime_add(psig->cstime, | 1243 | cputime_add(psig->cstime, |
| 1234 | cputime_add(p->stime, | 1244 | cputime_add(tgstime, |
| 1235 | cputime_add(sig->stime, | 1245 | sig->cstime)); |
| 1236 | sig->cstime))); | ||
| 1237 | psig->cgtime = | 1246 | psig->cgtime = |
| 1238 | cputime_add(psig->cgtime, | 1247 | cputime_add(psig->cgtime, |
| 1239 | cputime_add(p->gtime, | 1248 | cputime_add(p->gtime, |
