summaryrefslogtreecommitdiff
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorKirill Korotaev <kksx@mail.ru>2004-09-02 00:42:48 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-09-02 00:42:48 -0700
commit37cbd41da09cb39c9896c04ed8baac7526bb9547 (patch)
treec56359f143f02c3cf50996fb25a82fe896fae1ff /kernel/fork.c
parent3345ee71e2303c7c3d70de11d812306adc648865 (diff)
[PATCH] fixed pidhashing patch
This patch fixes strange and obscure pid implementation in current kernels: - it removes calling of put_task_struct() from detach_pid() under tasklist_lock. This allows to use blocking calls in security_task_free() hooks (in __put_task_struct()). - it saves some space = 5*5 ints = 100 bytes in task_struct - it's smaller and tidy, more straigthforward and doesn't use any knowledge about pids using and assignment. - it removes pid_links and pid_struct doesn't hold reference counters on task_struct. instead, new pid_structs and linked altogether and only one of them is inserted in hash_list. Signed-off-by: Kirill Korotaev (kksx@mail.ru) Signed-off-by: William Irwin <wli@holomorphy.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 9353b2e96700..78db8811c834 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1124,14 +1124,13 @@ static task_t *copy_process(unsigned long clone_flags,
__ptrace_link(p, current->parent);
attach_pid(p, PIDTYPE_PID, p->pid);
+ attach_pid(p, PIDTYPE_TGID, p->tgid);
if (thread_group_leader(p)) {
- attach_pid(p, PIDTYPE_TGID, p->tgid);
attach_pid(p, PIDTYPE_PGID, process_group(p));
attach_pid(p, PIDTYPE_SID, p->signal->session);
if (p->pid)
__get_cpu_var(process_counts)++;
- } else
- link_pid(p, p->pids + PIDTYPE_TGID, &p->group_leader->pids[PIDTYPE_TGID].pid);
+ }
nr_threads++;
write_unlock_irq(&tasklist_lock);