From 8990571eb573032c1192440febb17132074c5575 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 18 Oct 2007 23:40:19 -0700 Subject: 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 Cc: Sukadev Bhattiprolu Cc: Oleg Nesterov Cc: Paul Menage Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/capability.c | 2 +- kernel/pid.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'kernel') 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, int found = 0; struct pid *pgrp; - pgrp = find_pid_ns(pgrp_nr, current->nsproxy->pid_ns); + pgrp = find_vpid(pgrp_nr); do_each_pid_task(pgrp, PIDTYPE_PGID, g) { target = g; 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) } EXPORT_SYMBOL_GPL(find_pid_ns); +struct pid *find_vpid(int nr) +{ + return find_pid_ns(nr, current->nsproxy->pid_ns); +} +EXPORT_SYMBOL_GPL(find_vpid); + +struct pid *find_pid(int nr) +{ + return find_pid_ns(nr, &init_pid_ns); +} +EXPORT_SYMBOL_GPL(find_pid); + /* * attach_pid() must be called with the tasklist_lock write-held. */ -- cgit v1.2.3-59-g8ed1b