aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2004-10-19 18:31:59 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-19 18:31:59 -0700
commit1ce3ad5d6a1f9b5e24310406b72db19948504a25 (patch)
tree54938854f64eff223d0a634c7b354dfce6049b98 /kernel
parente45f49036ada350ab9936546b4d3a8d9bac4f106 (diff)
downloadhistory-1ce3ad5d6a1f9b5e24310406b72db19948504a25.tar.gz
[PATCH] detach_pid(): eliminate one find_pid() call
Now there is no point in calling costly find_pid(type) if __detach_pid(type) returned non zero value. Acked-By: Kirill Korotaev <dev@sw.ru> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/pid.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index 284f97a1ffa5d6..185a8bee816832 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -191,15 +191,16 @@ static fastcall int __detach_pid(task_t *task, enum pid_type type)
void fastcall detach_pid(task_t *task, enum pid_type type)
{
- int nr;
+ int tmp, nr;
nr = __detach_pid(task, type);
if (!nr)
return;
- for (type = 0; type < PIDTYPE_MAX; ++type)
- if (find_pid(type, nr))
+ for (tmp = PIDTYPE_MAX; --tmp >= 0; )
+ if (tmp != type && find_pid(tmp, nr))
return;
+
free_pidmap(nr);
}