aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/pid.c
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@us.ibm.com>2007-05-11 01:22:58 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 11:29:35 -0400
commite713d0dab21a68500720e222fa02567fc7dfb14b (patch)
treea56f90ce94d9287b73da6db72ed0e73542a70a07 /kernel/pid.c
parent4ac24b3ba9016881b11646114bb5cd12cf23edd9 (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/pid.c')
-rw-r--r--kernel/pid.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index d3ad724afa83..d76f59326bd4 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -247,13 +247,16 @@ struct pid * fastcall find_pid(int nr)
247} 247}
248EXPORT_SYMBOL_GPL(find_pid); 248EXPORT_SYMBOL_GPL(find_pid);
249 249
250int fastcall attach_pid(struct task_struct *task, enum pid_type type, int nr) 250/*
251 * attach_pid() must be called with the tasklist_lock write-held.
252 */
253int fastcall attach_pid(struct task_struct *task, enum pid_type type,
254 struct pid *pid)
251{ 255{
252 struct pid_link *link; 256 struct pid_link *link;
253 struct pid *pid;
254 257
255 link = &task->pids[type]; 258 link = &task->pids[type];
256 link->pid = pid = find_pid(nr); 259 link->pid = pid;
257 hlist_add_head_rcu(&link->node, &pid->tasks[type]); 260 hlist_add_head_rcu(&link->node, &pid->tasks[type]);
258 261
259 return 0; 262 return 0;