* [PATCH 1/2] detach_pid(): restore optimization
@ 2004-10-01 11:21 Oleg Nesterov
2004-10-02 13:18 ` Kirill Korotaev
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2004-10-01 11:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Kirill Korotaev, Andrew Morton, Linus Torvalds
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;
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/2] detach_pid(): restore optimization
2004-10-01 11:21 [PATCH 1/2] detach_pid(): restore optimization Oleg Nesterov
@ 2004-10-02 13:18 ` Kirill Korotaev
0 siblings, 0 replies; 2+ messages in thread
From: Kirill Korotaev @ 2004-10-02 13:18 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: linux-kernel, Andrew Morton, Linus Torvalds
I can sign off both patches. They look ok.
Signed-off-By: Kirill Korotaev <dev@sw.ru>
> 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.
[...]
Kirill
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-02 13:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-01 11:21 [PATCH 1/2] detach_pid(): restore optimization Oleg Nesterov
2004-10-02 13:18 ` Kirill Korotaev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox