aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index b0c6f0c3a2df..c6d14b8008dd 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -24,6 +24,7 @@
24#include <linux/pid_namespace.h> 24#include <linux/pid_namespace.h>
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/profile.h> 26#include <linux/profile.h>
27#include <linux/signalfd.h>
27#include <linux/mount.h> 28#include <linux/mount.h>
28#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
29#include <linux/kthread.h> 30#include <linux/kthread.h>
@@ -42,6 +43,7 @@
42#include <linux/audit.h> /* for audit_free() */ 43#include <linux/audit.h> /* for audit_free() */
43#include <linux/resource.h> 44#include <linux/resource.h>
44#include <linux/blkdev.h> 45#include <linux/blkdev.h>
46#include <linux/task_io_accounting_ops.h>
45 47
46#include <asm/uaccess.h> 48#include <asm/uaccess.h>
47#include <asm/unistd.h> 49#include <asm/unistd.h>
@@ -82,6 +84,14 @@ static void __exit_signal(struct task_struct *tsk)
82 sighand = rcu_dereference(tsk->sighand); 84 sighand = rcu_dereference(tsk->sighand);
83 spin_lock(&sighand->siglock); 85 spin_lock(&sighand->siglock);
84 86
87 /*
88 * Notify that this sighand has been detached. This must
89 * be called with the tsk->sighand lock held. Also, this
90 * access tsk->sighand internally, so it must be called
91 * before tsk->sighand is reset.
92 */
93 signalfd_detach_locked(tsk);
94
85 posix_cpu_timers_exit(tsk); 95 posix_cpu_timers_exit(tsk);
86 if (atomic_dec_and_test(&sig->count)) 96 if (atomic_dec_and_test(&sig->count))
87 posix_cpu_timers_exit_group(tsk); 97 posix_cpu_timers_exit_group(tsk);
@@ -113,6 +123,8 @@ static void __exit_signal(struct task_struct *tsk)
113 sig->nvcsw += tsk->nvcsw; 123 sig->nvcsw += tsk->nvcsw;
114 sig->nivcsw += tsk->nivcsw; 124 sig->nivcsw += tsk->nivcsw;
115 sig->sched_time += tsk->sched_time; 125 sig->sched_time += tsk->sched_time;
126 sig->inblock += task_io_get_inblock(tsk);
127 sig->oublock += task_io_get_oublock(tsk);
116 sig = NULL; /* Marker for below. */ 128 sig = NULL; /* Marker for below. */
117 } 129 }
118 130
@@ -299,12 +311,12 @@ void __set_special_pids(pid_t session, pid_t pgrp)
299 if (process_session(curr) != session) { 311 if (process_session(curr) != session) {
300 detach_pid(curr, PIDTYPE_SID); 312 detach_pid(curr, PIDTYPE_SID);
301 set_signal_session(curr->signal, session); 313 set_signal_session(curr->signal, session);
302 attach_pid(curr, PIDTYPE_SID, session); 314 attach_pid(curr, PIDTYPE_SID, find_pid(session));
303 } 315 }
304 if (process_group(curr) != pgrp) { 316 if (process_group(curr) != pgrp) {
305 detach_pid(curr, PIDTYPE_PGID); 317 detach_pid(curr, PIDTYPE_PGID);
306 curr->signal->pgrp = pgrp; 318 curr->signal->pgrp = pgrp;
307 attach_pid(curr, PIDTYPE_PGID, pgrp); 319 attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp));
308 } 320 }
309} 321}
310 322
@@ -1193,6 +1205,12 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
1193 p->nvcsw + sig->nvcsw + sig->cnvcsw; 1205 p->nvcsw + sig->nvcsw + sig->cnvcsw;
1194 psig->cnivcsw += 1206 psig->cnivcsw +=
1195 p->nivcsw + sig->nivcsw + sig->cnivcsw; 1207 p->nivcsw + sig->nivcsw + sig->cnivcsw;
1208 psig->cinblock +=
1209 task_io_get_inblock(p) +
1210 sig->inblock + sig->cinblock;
1211 psig->coublock +=
1212 task_io_get_oublock(p) +
1213 sig->oublock + sig->coublock;
1196 spin_unlock_irq(&p->parent->sighand->siglock); 1214 spin_unlock_irq(&p->parent->sighand->siglock);
1197 } 1215 }
1198 1216