diff options
author | Sukadev Bhattiprolu <sukadev@us.ibm.com> | 2007-05-11 01:22:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 11:29:35 -0400 |
commit | e713d0dab21a68500720e222fa02567fc7dfb14b (patch) | |
tree | a56f90ce94d9287b73da6db72ed0e73542a70a07 /kernel/fork.c | |
parent | 4ac24b3ba9016881b11646114bb5cd12cf23edd9 (diff) |
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>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index da92e01aba6b..6031800c94cf 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1249,16 +1249,19 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1249 | __ptrace_link(p, current->parent); | 1249 | __ptrace_link(p, current->parent); |
1250 | 1250 | ||
1251 | if (thread_group_leader(p)) { | 1251 | if (thread_group_leader(p)) { |
1252 | pid_t pgid = process_group(current); | ||
1253 | pid_t sid = process_session(current); | ||
1254 | |||
1252 | p->signal->tty = current->signal->tty; | 1255 | p->signal->tty = current->signal->tty; |
1253 | p->signal->pgrp = process_group(current); | 1256 | p->signal->pgrp = pgid; |
1254 | set_signal_session(p->signal, process_session(current)); | 1257 | set_signal_session(p->signal, process_session(current)); |
1255 | attach_pid(p, PIDTYPE_PGID, process_group(p)); | 1258 | attach_pid(p, PIDTYPE_PGID, find_pid(pgid)); |
1256 | attach_pid(p, PIDTYPE_SID, process_session(p)); | 1259 | attach_pid(p, PIDTYPE_SID, find_pid(sid)); |
1257 | 1260 | ||
1258 | list_add_tail_rcu(&p->tasks, &init_task.tasks); | 1261 | list_add_tail_rcu(&p->tasks, &init_task.tasks); |
1259 | __get_cpu_var(process_counts)++; | 1262 | __get_cpu_var(process_counts)++; |
1260 | } | 1263 | } |
1261 | attach_pid(p, PIDTYPE_PID, p->pid); | 1264 | attach_pid(p, PIDTYPE_PID, find_pid(p->pid)); |
1262 | nr_threads++; | 1265 | nr_threads++; |
1263 | } | 1266 | } |
1264 | 1267 | ||