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 1/2] detach_pid(): restore optimization
Date: Fri, 01 Oct 2004 15:21:56 +0400 [thread overview]
Message-ID: <415D3DD4.E440AB5B@tv-sign.ru> (raw)
Hello.
Kirill's kernel/pid.c rework broke optimization logic in detach_pid().
Non zero return from __detach_pid() was used to indicate, that this pid
can probably be freed. Current version always (modulo idle threads)
return non zero value, thus resulting in unneccesary pid_hash scanning.
Also, uninlining __detach_pid() reduces pid.o text size from 2492 to 1600
bytes.
Oleg.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.9-rc3/kernel/pid.c~ Thu Sep 30 15:05:25 2004
+++ 2.6.9-rc3/kernel/pid.c Fri Oct 1 11:26:11 2004
@@ -178,15 +178,18 @@ int fastcall attach_pid(task_t *task, en
return 0;
}
-static inline int __detach_pid(task_t *task, enum pid_type type)
+static fastcall int __detach_pid(task_t *task, enum pid_type type)
{
struct pid *pid, *pid_next;
- int nr;
+ int nr = 0;
pid = &task->pids[type];
if (!hlist_unhashed(&pid->pid_chain)) {
hlist_del(&pid->pid_chain);
- if (!list_empty(&pid->pid_list)) {
+
+ if (list_empty(&pid->pid_list))
+ nr = pid->nr;
+ else {
pid_next = list_entry(pid->pid_list.next,
struct pid, pid_list);
/* insert next pid from pid_list to hash */
@@ -194,8 +197,8 @@ static inline int __detach_pid(task_t *t
&pid_hash[type][pid_hashfn(pid_next->nr)]);
}
}
+
list_del(&pid->pid_list);
- nr = pid->nr;
pid->nr = 0;
return nr;
next reply other threads:[~2004-10-01 11:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-01 11:21 Oleg Nesterov [this message]
2004-10-02 13:18 ` [PATCH 1/2] detach_pid(): restore optimization Kirill Korotaev
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=415D3DD4.E440AB5B@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