]> err.no Git - linux-2.6/blobdiff - kernel/exit.c
pkt_sched: Grab correct lock in notify_and_destroy().
[linux-2.6] / kernel / exit.c
index da28745f7c3869854b9486ecc9d4b893f7571b19..38ec40630149bd07b97f06d406d9398763a6de8c 100644 (file)
@@ -121,18 +121,7 @@ static void __exit_signal(struct task_struct *tsk)
                sig->nivcsw += tsk->nivcsw;
                sig->inblock += task_io_get_inblock(tsk);
                sig->oublock += task_io_get_oublock(tsk);
-#ifdef CONFIG_TASK_XACCT
-               sig->rchar += tsk->rchar;
-               sig->wchar += tsk->wchar;
-               sig->syscr += tsk->syscr;
-               sig->syscw += tsk->syscw;
-#endif /* CONFIG_TASK_XACCT */
-#ifdef CONFIG_TASK_IO_ACCOUNTING
-               sig->ioac.read_bytes += tsk->ioac.read_bytes;
-               sig->ioac.write_bytes += tsk->ioac.write_bytes;
-               sig->ioac.cancelled_write_bytes +=
-                                       tsk->ioac.cancelled_write_bytes;
-#endif /* CONFIG_TASK_IO_ACCOUNTING */
+               task_io_accounting_add(&sig->ioac, &tsk->ioac);
                sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
                sig = NULL; /* Marker for below. */
        }
@@ -565,8 +554,6 @@ void put_fs_struct(struct fs_struct *fs)
        if (atomic_dec_and_test(&fs->count)) {
                path_put(&fs->root);
                path_put(&fs->pwd);
-               if (fs->altroot.dentry)
-                       path_put(&fs->altroot);
                kmem_cache_free(fs_cachep, fs);
        }
 }
@@ -885,7 +872,8 @@ static void forget_original_parent(struct task_struct *father)
  */
 static void exit_notify(struct task_struct *tsk, int group_dead)
 {
-       int state;
+       int signal;
+       void *cookie;
 
        /*
         * This does two things:
@@ -922,22 +910,11 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
            !capable(CAP_KILL))
                tsk->exit_signal = SIGCHLD;
 
-       /* If something other than our normal parent is ptracing us, then
-        * send it a SIGCHLD instead of honoring exit_signal.  exit_signal
-        * only has special meaning to our real parent.
-        */
-       if (!task_detached(tsk) && thread_group_empty(tsk)) {
-               int signal = ptrace_reparented(tsk) ?
-                               SIGCHLD : tsk->exit_signal;
-               do_notify_parent(tsk, signal);
-       } else if (tsk->ptrace) {
-               do_notify_parent(tsk, SIGCHLD);
-       }
+       signal = tracehook_notify_death(tsk, &cookie, group_dead);
+       if (signal >= 0)
+               signal = do_notify_parent(tsk, signal);
 
-       state = EXIT_ZOMBIE;
-       if (task_detached(tsk) && likely(!tsk->ptrace))
-               state = EXIT_DEAD;
-       tsk->exit_state = state;
+       tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE;
 
        /* mt-exec, de_thread() is waiting for us */
        if (thread_group_leader(tsk) &&
@@ -947,8 +924,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
 
        write_unlock_irq(&tasklist_lock);
 
+       tracehook_report_death(tsk, signal, cookie, group_dead);
+
        /* If the process is dead, release it - nobody will wait for it */
-       if (state == EXIT_DEAD)
+       if (signal == DEATH_REAP)
                release_task(tsk);
 }
 
@@ -1373,21 +1352,8 @@ static int wait_task_zombie(struct task_struct *p, int options,
                psig->coublock +=
                        task_io_get_oublock(p) +
                        sig->oublock + sig->coublock;
-#ifdef CONFIG_TASK_XACCT
-               psig->rchar += p->rchar + sig->rchar;
-               psig->wchar += p->wchar + sig->wchar;
-               psig->syscr += p->syscr + sig->syscr;
-               psig->syscw += p->syscw + sig->syscw;
-#endif /* CONFIG_TASK_XACCT */
-#ifdef CONFIG_TASK_IO_ACCOUNTING
-               psig->ioac.read_bytes +=
-                       p->ioac.read_bytes + sig->ioac.read_bytes;
-               psig->ioac.write_bytes +=
-                       p->ioac.write_bytes + sig->ioac.write_bytes;
-               psig->ioac.cancelled_write_bytes +=
-                               p->ioac.cancelled_write_bytes +
-                               sig->ioac.cancelled_write_bytes;
-#endif /* CONFIG_TASK_IO_ACCOUNTING */
+               task_io_accounting_add(&psig->ioac, &p->ioac);
+               task_io_accounting_add(&psig->ioac, &sig->ioac);
                spin_unlock_irq(&p->parent->sighand->siglock);
        }