[PATCH] Unlinline a bunch of other functions
[safe/jmp/linux-2.6] / kernel / exit.c
index 2d39ccc..93cee36 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/interrupt.h>
 #include <linux/smp_lock.h>
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/completion.h>
 #include <linux/personality.h>
 #include <linux/tty.h>
@@ -28,6 +29,8 @@
 #include <linux/cpuset.h>
 #include <linux/syscalls.h>
 #include <linux/signal.h>
+#include <linux/cn_proc.h>
+#include <linux/mutex.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -71,7 +74,6 @@ repeat:
                __ptrace_unlink(p);
        BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));
        __exit_signal(p);
-       __exit_sighand(p);
        /*
         * Note that the fastpath in sys_times depends on __exit_signal having
         * updated the counters before a task is removed from the tasklist of
@@ -191,7 +193,7 @@ int is_orphaned_pgrp(int pgrp)
        return retval;
 }
 
-static inline int has_stopped_jobs(int pgrp)
+static int has_stopped_jobs(int pgrp)
 {
        int retval = 0;
        struct task_struct *p;
@@ -228,7 +230,7 @@ static inline int has_stopped_jobs(int pgrp)
  *
  * NOTE that reparent_to_init() gives the caller full capabilities.
  */
-static inline void reparent_to_init(void)
+static void reparent_to_init(void)
 {
        write_lock_irq(&tasklist_lock);
 
@@ -242,7 +244,9 @@ static inline void reparent_to_init(void)
        /* Set the exit signal to SIGCHLD so we signal init on exit */
        current->exit_signal = SIGCHLD;
 
-       if ((current->policy == SCHED_NORMAL) && (task_nice(current) < 0))
+       if ((current->policy == SCHED_NORMAL ||
+                       current->policy == SCHED_BATCH)
+                               && (task_nice(current) < 0))
                set_user_nice(current, 0);
        /* cpus_allowed? */
        /* rt_priority? */
@@ -257,7 +261,7 @@ static inline void reparent_to_init(void)
 
 void __set_special_pids(pid_t session, pid_t pgrp)
 {
-       struct task_struct *curr = current;
+       struct task_struct *curr = current->group_leader;
 
        if (curr->signal->session != session) {
                detach_pid(curr, PIDTYPE_SID);
@@ -365,7 +369,7 @@ void daemonize(const char *name, ...)
 
 EXPORT_SYMBOL(daemonize);
 
-static inline void close_files(struct files_struct * files)
+static void close_files(struct files_struct * files)
 {
        int i, j;
        struct fdtable *fdt;
@@ -539,7 +543,7 @@ static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_re
        p->real_parent = reaper;
 }
 
-static inline void reparent_thread(task_t *p, task_t *father, int traced)
+static void reparent_thread(task_t *p, task_t *father, int traced)
 {
        /* We don't want people slaying init.  */
        if (p->exit_signal != -1)
@@ -547,7 +551,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced)
 
        if (p->pdeath_signal)
                /* We already hold the tasklist_lock here.  */
-               group_send_sig_info(p->pdeath_signal, (void *) 0, p);
+               group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
 
        /* Move the child from its dying parent to the new one.  */
        if (unlikely(traced)) {
@@ -591,8 +595,8 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced)
                int pgrp = process_group(p);
 
                if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) {
-                       __kill_pg_info(SIGHUP, (void *)1, pgrp);
-                       __kill_pg_info(SIGCONT, (void *)1, pgrp);
+                       __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp);
+                       __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp);
                }
        }
 }
@@ -603,7 +607,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced)
  * group, and if no such member exists, give it to
  * the global child reaper process (ie "init")
  */
-static inline void forget_original_parent(struct task_struct * father,
+static void forget_original_parent(struct task_struct * father,
                                          struct list_head *to_release)
 {
        struct task_struct *p, *reaper = father;
@@ -727,8 +731,8 @@ static void exit_notify(struct task_struct *tsk)
            (t->signal->session == tsk->signal->session) &&
            will_become_orphaned_pgrp(process_group(tsk), tsk) &&
            has_stopped_jobs(process_group(tsk))) {
-               __kill_pg_info(SIGHUP, (void *)1, process_group(tsk));
-               __kill_pg_info(SIGCONT, (void *)1, process_group(tsk));
+               __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk));
+               __kill_pg_info(SIGCONT, SEND_SIG_PRIV, process_group(tsk));
        }
 
        /* Let father know we died 
@@ -841,7 +845,7 @@ fastcall NORET_TYPE void do_exit(long code)
        }
        group_dead = atomic_dec_and_test(&tsk->signal->live);
        if (group_dead) {
-               del_timer_sync(&tsk->signal->real_timer);
+               hrtimer_cancel(&tsk->signal->real_timer);
                exit_itimers(tsk->signal);
                acct_process(code);
        }
@@ -858,16 +862,21 @@ fastcall NORET_TYPE void do_exit(long code)
        if (group_dead && tsk->signal->leader)
                disassociate_ctty(1);
 
-       module_put(tsk->thread_info->exec_domain->module);
+       module_put(task_thread_info(tsk)->exec_domain->module);
        if (tsk->binfmt)
                module_put(tsk->binfmt->module);
 
        tsk->exit_code = code;
+       proc_exit_connector(tsk);
        exit_notify(tsk);
 #ifdef CONFIG_NUMA
        mpol_free(tsk->mempolicy);
        tsk->mempolicy = NULL;
 #endif
+       /*
+        * If DEBUG_MUTEXES is on, make sure we are holding no locks:
+        */
+       mutex_debug_check_no_locks_held(tsk);
 
        /* PF_DEAD causes final put_task_struct after we schedule. */
        preempt_disable();
@@ -924,7 +933,6 @@ do_group_exit(int exit_code)
                        /* Another thread got here before we took the lock.  */
                        exit_code = sig->group_exit_code;
                else {
-                       sig->flags = SIGNAL_GROUP_EXIT;
                        sig->group_exit_code = exit_code;
                        zap_other_threads(current);
                }
@@ -1066,6 +1074,9 @@ static int wait_task_zombie(task_t *p, int noreap,
        }
 
        if (likely(p->real_parent == p->parent) && likely(p->signal)) {
+               struct signal_struct *psig;
+               struct signal_struct *sig;
+
                /*
                 * The resource counters for the group leader are in its
                 * own task_struct.  Those for dead threads in the group
@@ -1082,24 +1093,26 @@ static int wait_task_zombie(task_t *p, int noreap,
                 * here reaping other children at the same time.
                 */
                spin_lock_irq(&p->parent->sighand->siglock);
-               p->parent->signal->cutime =
-                       cputime_add(p->parent->signal->cutime,
+               psig = p->parent->signal;
+               sig = p->signal;
+               psig->cutime =
+                       cputime_add(psig->cutime,
                        cputime_add(p->utime,
-                       cputime_add(p->signal->utime,
-                                   p->signal->cutime)));
-               p->parent->signal->cstime =
-                       cputime_add(p->parent->signal->cstime,
+                       cputime_add(sig->utime,
+                                   sig->cutime)));
+               psig->cstime =
+                       cputime_add(psig->cstime,
                        cputime_add(p->stime,
-                       cputime_add(p->signal->stime,
-                                   p->signal->cstime)));
-               p->parent->signal->cmin_flt +=
-                       p->min_flt + p->signal->min_flt + p->signal->cmin_flt;
-               p->parent->signal->cmaj_flt +=
-                       p->maj_flt + p->signal->maj_flt + p->signal->cmaj_flt;
-               p->parent->signal->cnvcsw +=
-                       p->nvcsw + p->signal->nvcsw + p->signal->cnvcsw;
-               p->parent->signal->cnivcsw +=
-                       p->nivcsw + p->signal->nivcsw + p->signal->cnivcsw;
+                       cputime_add(sig->stime,
+                                   sig->cstime)));
+               psig->cmin_flt +=
+                       p->min_flt + sig->min_flt + sig->cmin_flt;
+               psig->cmaj_flt +=
+                       p->maj_flt + sig->maj_flt + sig->cmaj_flt;
+               psig->cnvcsw +=
+                       p->nvcsw + sig->nvcsw + sig->cnvcsw;
+               psig->cnivcsw +=
+                       p->nivcsw + sig->nivcsw + sig->cnivcsw;
                spin_unlock_irq(&p->parent->sighand->siglock);
        }