tracing: Change tracing_pipe_fops() to rely on tracing_get_cpu()
[firefly-linux-kernel-4.4.55.git] / kernel / fork.c
index 7d6962fb61561f8bdf62ecccedb472352676e0f3..66635c80a813e876d3a3529ed13ce410ab987c4e 100644 (file)
@@ -365,8 +365,6 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
        mm->locked_vm = 0;
        mm->mmap = NULL;
        mm->mmap_cache = NULL;
-       mm->free_area_cache = oldmm->mmap_base;
-       mm->cached_hole_size = ~0UL;
        mm->map_count = 0;
        cpumask_clear(mm_cpumask(mm));
        mm->mm_rb = RB_ROOT;
@@ -540,8 +538,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
        mm->nr_ptes = 0;
        memset(&mm->rss_stat, 0, sizeof(mm->rss_stat));
        spin_lock_init(&mm->page_table_lock);
-       mm->free_area_cache = TASK_UNMAPPED_BASE;
-       mm->cached_hole_size = ~0UL;
        mm_init_aio(mm);
        mm_init_owner(mm, p);
 
@@ -1360,11 +1356,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
                        goto bad_fork_cleanup_io;
        }
 
-       p->pid = pid_nr(pid);
-       p->tgid = p->pid;
-       if (clone_flags & CLONE_THREAD)
-               p->tgid = current->tgid;
-
        p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
        /*
         * Clear TID on mm_release()?
@@ -1400,12 +1391,19 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        clear_all_latency_tracing(p);
 
        /* ok, now we should be set up.. */
-       if (clone_flags & CLONE_THREAD)
+       p->pid = pid_nr(pid);
+       if (clone_flags & CLONE_THREAD) {
                p->exit_signal = -1;
-       else if (clone_flags & CLONE_PARENT)
-               p->exit_signal = current->group_leader->exit_signal;
-       else
-               p->exit_signal = (clone_flags & CSIGNAL);
+               p->group_leader = current->group_leader;
+               p->tgid = current->tgid;
+       } else {
+               if (clone_flags & CLONE_PARENT)
+                       p->exit_signal = current->group_leader->exit_signal;
+               else
+                       p->exit_signal = (clone_flags & CSIGNAL);
+               p->group_leader = p;
+               p->tgid = p->pid;
+       }
 
        p->pdeath_signal = 0;
        p->exit_state = 0;
@@ -1414,15 +1412,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10);
        p->dirty_paused_when = 0;
 
-       /*
-        * Ok, make it visible to the rest of the system.
-        * We dont wake it up yet.
-        */
-       p->group_leader = p;
        INIT_LIST_HEAD(&p->thread_group);
        p->task_works = NULL;
 
-       /* Need tasklist lock for parent etc handling! */
+       /*
+        * Make it visible to the rest of the system, but dont wake it up yet.
+        * Need tasklist lock for parent etc handling!
+        */
        write_lock_irq(&tasklist_lock);
 
        /* CLONE_PARENT re-uses the old parent */
@@ -1476,7 +1472,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
                        current->signal->nr_threads++;
                        atomic_inc(&current->signal->live);
                        atomic_inc(&current->signal->sigcnt);
-                       p->group_leader = current->group_leader;
                        list_add_tail_rcu(&p->thread_group,
                                          &p->group_leader->thread_group);
                }