Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[powerpc.git] / kernel / fork.c
index 33f12f4..2ce28f1 100644 (file)
@@ -107,6 +107,7 @@ static struct kmem_cache *mm_cachep;
 
 void free_task(struct task_struct *tsk)
 {
+       prop_local_destroy_single(&tsk->dirties);
        free_thread_info(tsk->stack);
        rt_mutex_debug_task_free(tsk);
        free_task_struct(tsk);
@@ -163,6 +164,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
 {
        struct task_struct *tsk;
        struct thread_info *ti;
+       int err;
 
        prepare_to_copy(orig);
 
@@ -178,6 +180,14 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
 
        *tsk = *orig;
        tsk->stack = ti;
+
+       err = prop_local_init_single(&tsk->dirties);
+       if (err) {
+               free_thread_info(ti);
+               free_task_struct(tsk);
+               return NULL;
+       }
+
        setup_thread_stack(tsk, orig);
 
 #ifdef CONFIG_CC_STACKPROTECTOR
@@ -258,7 +268,7 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
                        get_file(file);
                        if (tmp->vm_flags & VM_DENYWRITE)
                                atomic_dec(&inode->i_writecount);
-      
+
                        /* insert tmp into the share list, just after mpnt */
                        spin_lock(&file->f_mapping->i_mmap_lock);
                        tmp->vm_truncate_count = mpnt->vm_truncate_count;
@@ -321,7 +331,7 @@ static inline void mm_free_pgd(struct mm_struct * mm)
 #define mm_free_pgd(mm)
 #endif /* CONFIG_MMU */
 
- __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
+__cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
 
 #define allocate_mm()  (kmem_cache_alloc(mm_cachep, GFP_KERNEL))
 #define free_mm(mm)    (kmem_cache_free(mm_cachep, (mm)))
@@ -728,8 +738,8 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
        /* compute the remainder to be cleared */
        size = (new_fdt->max_fds - open_files) * sizeof(struct file *);
 
-       /* This is long word aligned thus could use a optimized version */ 
-       memset(new_fds, 0, size); 
+       /* This is long word aligned thus could use a optimized version */
+       memset(new_fds, 0, size);
 
        if (new_fdt->max_fds > open_files) {
                int left = (new_fdt->max_fds-open_files)/8;
@@ -877,6 +887,8 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
        sig->tty_old_pgrp = NULL;
 
        sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;
+       sig->gtime = cputime_zero;
+       sig->cgtime = cputime_zero;
        sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;
        sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
        sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;
@@ -930,6 +942,7 @@ static inline void copy_flags(unsigned long clone_flags, struct task_struct *p)
        if (!(clone_flags & CLONE_PTRACE))
                p->ptrace = 0;
        p->flags = new_flags;
+       clear_freeze_flag(p);
 }
 
 asmlinkage long sys_set_tid_address(int __user *tidptr)
@@ -1045,6 +1058,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
        p->utime = cputime_zero;
        p->stime = cputime_zero;
+       p->gtime = cputime_zero;
+       p->utimescaled = cputime_zero;
+       p->stimescaled = cputime_zero;
 
 #ifdef CONFIG_TASK_XACCT
        p->rchar = 0;           /* I/O counter: bytes read */
@@ -1055,20 +1071,21 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        task_io_accounting_init(p);
        acct_clear_integrals(p);
 
-       p->it_virt_expires = cputime_zero;
+       p->it_virt_expires = cputime_zero;
        p->it_prof_expires = cputime_zero;
-       p->it_sched_expires = 0;
-       INIT_LIST_HEAD(&p->cpu_timers[0]);
-       INIT_LIST_HEAD(&p->cpu_timers[1]);
-       INIT_LIST_HEAD(&p->cpu_timers[2]);
+       p->it_sched_expires = 0;
+       INIT_LIST_HEAD(&p->cpu_timers[0]);
+       INIT_LIST_HEAD(&p->cpu_timers[1]);
+       INIT_LIST_HEAD(&p->cpu_timers[2]);
 
        p->lock_depth = -1;             /* -1 = no lock */
        do_posix_clock_monotonic_gettime(&p->start_time);
        p->real_start_time = p->start_time;
        monotonic_to_bootbased(&p->real_start_time);
+#ifdef CONFIG_SECURITY
        p->security = NULL;
+#endif
        p->io_context = NULL;
-       p->io_wait = NULL;
        p->audit_context = NULL;
        cpuset_fork(p);
 #ifdef CONFIG_NUMA
@@ -1143,13 +1160,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         * Clear TID on mm_release()?
         */
        p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
+#ifdef CONFIG_FUTEX
        p->robust_list = NULL;
 #ifdef CONFIG_COMPAT
        p->compat_robust_list = NULL;
 #endif
        INIT_LIST_HEAD(&p->pi_state_list);
        p->pi_state_cache = NULL;
-
+#endif
        /*
         * sigaltstack should be cleared when sharing the same VM
         */
@@ -1223,7 +1241,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         * A fatal signal pending means that current will exit, so the new
         * thread can't slip out of an OOM kill (or normal SIGKILL).
         */
-       recalc_sigpending();
+       recalc_sigpending();
        if (signal_pending(current)) {
                spin_unlock(&current->sighand->siglock);
                write_unlock_irq(&tasklist_lock);
@@ -1432,8 +1450,7 @@ long do_fork(unsigned long clone_flags,
 #define ARCH_MIN_MMSTRUCT_ALIGN 0
 #endif
 
-static void sighand_ctor(void *data, struct kmem_cache *cachep,
-                       unsigned long flags)
+static void sighand_ctor(struct kmem_cache *cachep, void *data)
 {
        struct sighand_struct *sighand = data;
 
@@ -1608,7 +1625,8 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
        err = -EINVAL;
        if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
                                CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|
-                               CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER))
+                               CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER|
+                               CLONE_NEWNET))
                goto bad_unshare_out;
 
        if ((err = unshare_thread(unshare_flags)))