This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / kernel / exit.c
index 2b2f728..5bc8fff 100644 (file)
@@ -23,6 +23,9 @@
 #include <linux/mount.h>
 #include <linux/proc_fs.h>
 #include <linux/mempolicy.h>
+#include <linux/ckrm.h>
+#include <linux/ckrm_tsk.h>
+#include <linux/vs_limit.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -37,6 +40,11 @@ int getrusage(struct task_struct *, int, struct rusage __user *);
 static void __unhash_process(struct task_struct *p)
 {
        nr_threads--;
+       /* tasklist_lock is held, is this sufficient? */
+       if (p->vx_info) {
+               atomic_dec(&p->vx_info->cacct.nr_threads);
+               atomic_dec(&p->vx_info->limit.rcur[RLIMIT_NPROC]);
+       }
        detach_pid(p, PIDTYPE_PID);
        detach_pid(p, PIDTYPE_TGID);
        if (thread_group_leader(p)) {
@@ -99,7 +107,7 @@ repeat:
        sched_exit(p);
        write_unlock_irq(&tasklist_lock);
        spin_unlock(&p->proc_lock);
-       proc_pid_flush(proc_dentry);
+       dput(proc_dentry);
        release_thread(p);
        put_task_struct(p);
 
@@ -236,6 +244,7 @@ void reparent_to_init(void)
        ptrace_unlink(current);
        /* Reparent to init */
        REMOVE_LINKS(current);
+       /* FIXME handle vchild_reaper/initpid */
        current->parent = child_reaper;
        current->real_parent = child_reaper;
        SET_LINKS(current);
@@ -378,8 +387,11 @@ static inline void close_files(struct files_struct * files)
                while (set) {
                        if (set & 1) {
                                struct file * file = xchg(&files->fd[i], NULL);
-                               if (file)
+                               if (file) {
                                        filp_close(file, files);
+                                       cond_resched();
+                               }
+                               // vx_openfd_dec(fd);
                        }
                        i++;
                        set >>= 1;
@@ -600,6 +612,7 @@ static inline void forget_original_parent(struct task_struct * father,
        struct task_struct *p, *reaper = father;
        struct list_head *_p, *_n;
 
+       /* FIXME handle vchild_reaper/initpid */
        reaper = father->group_leader;
        if (reaper == father)
                reaper = child_reaper;
@@ -659,6 +672,8 @@ static void exit_notify(struct task_struct *tsk)
        struct task_struct *t;
        struct list_head ptrace_dead, *_p, *_n;
 
+       ckrm_cb_exit(tsk);
+
        if (signal_pending(tsk) && !tsk->signal->group_exit
            && !thread_group_empty(tsk)) {
                /*
@@ -821,6 +836,13 @@ asmlinkage NORET_TYPE void do_exit(long code)
        }
 
        acct_process(code);
+       if (current->tux_info) {
+#ifdef CONFIG_TUX_DEBUG
+               printk("Possibly unexpected TUX-thread exit(%ld) at %p?\n",
+                       code, __builtin_return_address(0));
+#endif
+               current->tux_exit();
+       }
        __exit_mm(tsk);
 
        exit_sem(tsk);
@@ -837,6 +859,9 @@ asmlinkage NORET_TYPE void do_exit(long code)
                module_put(tsk->binfmt->module);
 
        tsk->exit_code = code;
+#ifdef CONFIG_CKRM_TYPE_TASKCLASS
+       numtasks_put_ref(tsk->taskclass);
+#endif
        exit_notify(tsk);
 #ifdef CONFIG_NUMA
        mpol_free(tsk->mempolicy);