diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-19 02:40:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:41 -0400 |
commit | 8990571eb573032c1192440febb17132074c5575 (patch) | |
tree | c5cceff1dbac91ca12917e12f5768a5ab332ec75 | |
parent | bac0abd6174e427404dd197cdbefece31e97329b (diff) |
Uninline find_pid etc set of functions
The find_pid/_vpid/_pid_ns functions are used to find the struct pid by its
id, depending on whic id - global or virtual - is used.
The find_vpid() is a macro that pushes the current->nsproxy->pid_ns on the
stack to call another function - find_pid_ns(). It turned out, that this
dereference together with the push itself cause the kernel text size to
grow too much.
Move all these out-of-line. Together with the previous patch this saves a
bit less that 400 bytes from .text section.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Paul Menage <menage@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/pid.h | 5 | ||||
-rw-r--r-- | kernel/capability.c | 2 | ||||
-rw-r--r-- | kernel/pid.c | 12 |
3 files changed, 15 insertions, 4 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h index 4817c6671e77..e29a900a8499 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -110,9 +110,8 @@ extern struct pid_namespace init_pid_ns; | |||
110 | * see also find_task_by_pid() set in include/linux/sched.h | 110 | * see also find_task_by_pid() set in include/linux/sched.h |
111 | */ | 111 | */ |
112 | extern struct pid *FASTCALL(find_pid_ns(int nr, struct pid_namespace *ns)); | 112 | extern struct pid *FASTCALL(find_pid_ns(int nr, struct pid_namespace *ns)); |
113 | 113 | extern struct pid *find_vpid(int nr); | |
114 | #define find_vpid(pid) find_pid_ns(pid, current->nsproxy->pid_ns) | 114 | extern struct pid *find_pid(int nr); |
115 | #define find_pid(pid) find_pid_ns(pid, &init_pid_ns) | ||
116 | 115 | ||
117 | /* | 116 | /* |
118 | * Lookup a PID in the hash table, and return with it's count elevated. | 117 | * Lookup a PID in the hash table, and return with it's count elevated. |
diff --git a/kernel/capability.c b/kernel/capability.c index 0d0d886d1e84..efbd9cdce132 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -96,7 +96,7 @@ static inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective, | |||
96 | int found = 0; | 96 | int found = 0; |
97 | struct pid *pgrp; | 97 | struct pid *pgrp; |
98 | 98 | ||
99 | pgrp = find_pid_ns(pgrp_nr, current->nsproxy->pid_ns); | 99 | pgrp = find_vpid(pgrp_nr); |
100 | do_each_pid_task(pgrp, PIDTYPE_PGID, g) { | 100 | do_each_pid_task(pgrp, PIDTYPE_PGID, g) { |
101 | target = g; | 101 | target = g; |
102 | while_each_thread(g, target) { | 102 | while_each_thread(g, target) { |
diff --git a/kernel/pid.c b/kernel/pid.c index bed9e7f80a50..8040533d1a04 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -302,6 +302,18 @@ struct pid * fastcall find_pid_ns(int nr, struct pid_namespace *ns) | |||
302 | } | 302 | } |
303 | EXPORT_SYMBOL_GPL(find_pid_ns); | 303 | EXPORT_SYMBOL_GPL(find_pid_ns); |
304 | 304 | ||
305 | struct pid *find_vpid(int nr) | ||
306 | { | ||
307 | return find_pid_ns(nr, current->nsproxy->pid_ns); | ||
308 | } | ||
309 | EXPORT_SYMBOL_GPL(find_vpid); | ||
310 | |||
311 | struct pid *find_pid(int nr) | ||
312 | { | ||
313 | return find_pid_ns(nr, &init_pid_ns); | ||
314 | } | ||
315 | EXPORT_SYMBOL_GPL(find_pid); | ||
316 | |||
305 | /* | 317 | /* |
306 | * attach_pid() must be called with the tasklist_lock write-held. | 318 | * attach_pid() must be called with the tasklist_lock write-held. |
307 | */ | 319 | */ |