mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
kernel/fork.c:copy_process(): unify CLONE_THREAD-or-thread_group_leader code
commit 80628ca06c5d42929de6bc22c0a41589a834d151 upstream. Cleanup and preparation for the next changes. Move the "if (clone_flags & CLONE_THREAD)" code down under "if (likely(p->pid))" and turn it into into the "else" branch. This makes the process/thread initialization more symmetrical and removes one check. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Sergey Dyasly <dserrg@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Li Zefan <lizefan@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4479103c7e
commit
beed61068f
1 changed files with 7 additions and 8 deletions
|
@ -1448,14 +1448,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
|||
goto bad_fork_free_pid;
|
||||
}
|
||||
|
||||
if (clone_flags & CLONE_THREAD) {
|
||||
current->signal->nr_threads++;
|
||||
atomic_inc(¤t->signal->live);
|
||||
atomic_inc(¤t->signal->sigcnt);
|
||||
p->group_leader = current->group_leader;
|
||||
list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
|
||||
}
|
||||
|
||||
if (likely(p->pid)) {
|
||||
ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
|
||||
|
||||
|
@ -1472,6 +1464,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
|||
list_add_tail(&p->sibling, &p->real_parent->children);
|
||||
list_add_tail_rcu(&p->tasks, &init_task.tasks);
|
||||
__this_cpu_inc(process_counts);
|
||||
} else {
|
||||
current->signal->nr_threads++;
|
||||
atomic_inc(¤t->signal->live);
|
||||
atomic_inc(¤t->signal->sigcnt);
|
||||
p->group_leader = current->group_leader;
|
||||
list_add_tail_rcu(&p->thread_group,
|
||||
&p->group_leader->thread_group);
|
||||
}
|
||||
attach_pid(p, PIDTYPE_PID, pid);
|
||||
nr_threads++;
|
||||
|
|
Loading…
Reference in a new issue