#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 <linux/ckrm_mem.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
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)) {
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);
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);
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;
task_lock(tsk);
tsk->mm = NULL;
up_read(&mm->mmap_sem);
+#ifdef CONFIG_CKRM_RES_MEM
+ spin_lock(&mm->peertask_lock);
+ list_del_init(&tsk->mm_peers);
+ ckrm_mem_evaluate_mm(mm);
+ spin_unlock(&mm->peertask_lock);
+#endif
enter_lazy_tlb(mm, current);
task_unlock(tsk);
mmput(mm);
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;
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)) {
/*
}
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);