From ea306a2acfd41396c908552e49f1c1ab4adcdac8 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Sun, 21 Apr 2002 23:03:18 -0700 Subject: [PATCH] (1/5) sane procfs/dcache interaction - take unhash_process() into sched.c, move zeroing ->pid into it (and under tasklist_lock) --- include/linux/sched.h | 10 +--------- kernel/exit.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index f5fd7b435bd1..8f0df64bb723 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -769,15 +769,7 @@ static inline struct task_struct *younger_sibling(struct task_struct *p) #define thread_group_leader(p) (p->pid == p->tgid) -static inline void unhash_process(struct task_struct *p) -{ - write_lock_irq(&tasklist_lock); - nr_threads--; - unhash_pid(p); - REMOVE_LINKS(p); - list_del(&p->thread_group); - write_unlock_irq(&tasklist_lock); -} +extern void unhash_process(struct task_struct *p); /* Protects ->fs, ->files, ->mm, and synchronises with wait4(). Nests inside tasklist_lock */ static inline void task_lock(struct task_struct *p) diff --git a/kernel/exit.c b/kernel/exit.c index feb2470a6024..58b05e3ef9f8 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -27,6 +27,17 @@ extern struct task_struct *child_reaper; int getrusage(struct task_struct *, int, struct rusage *); +static inline void __unhash_process(struct task_struct *p) +{ + write_lock_irq(&tasklist_lock); + nr_threads--; + unhash_pid(p); + REMOVE_LINKS(p); + list_del(&p->thread_group); + p->pid = 0; + write_unlock_irq(&tasklist_lock); +} + static void release_task(struct task_struct * p) { if (p == current) @@ -43,10 +54,16 @@ static void release_task(struct task_struct * p) current->cmaj_flt += p->maj_flt + p->cmaj_flt; current->cnswap += p->nswap + p->cnswap; sched_exit(p); - p->pid = 0; put_task_struct(p); } +/* we are using it only for SMP init */ + +void unhash_process(struct task_struct *p) +{ + return __unhash_process(p); +} + /* * This checks not only the pgrp, but falls back on the pid if no * satisfactory pgrp is found. I dunno - gdb doesn't work correctly -- cgit v1.2.3