mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
attach_pid() with struct pid parameter
attach_pid() currently takes a pid_t and then uses find_pid() to find the corresponding struct pid. Sometimes we already have the struct pid. We can then skip find_pid() if attach_pid() were to take a struct pid parameter. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Cc: Cedric Le Goater <clg@fr.ibm.com> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Serge Hallyn <serue@us.ibm.com> Cc: <containers@lists.osdl.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4ac24b3ba9
commit
e713d0dab2
6 changed files with 18 additions and 13 deletions
|
@ -1249,16 +1249,19 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
|||
__ptrace_link(p, current->parent);
|
||||
|
||||
if (thread_group_leader(p)) {
|
||||
pid_t pgid = process_group(current);
|
||||
pid_t sid = process_session(current);
|
||||
|
||||
p->signal->tty = current->signal->tty;
|
||||
p->signal->pgrp = process_group(current);
|
||||
p->signal->pgrp = pgid;
|
||||
set_signal_session(p->signal, process_session(current));
|
||||
attach_pid(p, PIDTYPE_PGID, process_group(p));
|
||||
attach_pid(p, PIDTYPE_SID, process_session(p));
|
||||
attach_pid(p, PIDTYPE_PGID, find_pid(pgid));
|
||||
attach_pid(p, PIDTYPE_SID, find_pid(sid));
|
||||
|
||||
list_add_tail_rcu(&p->tasks, &init_task.tasks);
|
||||
__get_cpu_var(process_counts)++;
|
||||
}
|
||||
attach_pid(p, PIDTYPE_PID, p->pid);
|
||||
attach_pid(p, PIDTYPE_PID, find_pid(p->pid));
|
||||
nr_threads++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue