From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Kirill Korotaev <dev@sw.ru>, Andrew Morton <akpm@osdl.org>,
Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH 2/2] detach_pid(): eliminate one find_pid() call
Date: Fri, 01 Oct 2004 15:21:59 +0400 [thread overview]
Message-ID: <415D3DD7.57221E60@tv-sign.ru> (raw)
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);
}
reply other threads:[~2004-10-01 11:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=415D3DD7.57221E60@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=dev@sw.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®