mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] detach_pid(): eliminate one find_pid() call
@ 2004-10-01 11:21 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2004-10-01 11:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kirill Korotaev, Andrew Morton, Linus Torvalds

Hello.

Now there is no point in calling costly find_pid(type)
if __detach_pid(type) returned non zero value.

Oleg.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.9-rc3/kernel/pid.c~	Fri Oct  1 13:29:14 2004
+++ 2.6.9-rc3/kernel/pid.c	Fri Oct  1 15:12:32 2004
@@ -206,15 +206,16 @@ static fastcall int __detach_pid(task_t 
 
 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);
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-01 11:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-01 11:21 [PATCH 2/2] detach_pid(): eliminate one find_pid() call Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®