Commit ea306a2a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (1/5) sane procfs/dcache interaction

 - take unhash_process() into sched.c, move zeroing ->pid into it (and
   under tasklist_lock)
parent 87f77892
...@@ -769,15 +769,7 @@ static inline struct task_struct *younger_sibling(struct task_struct *p) ...@@ -769,15 +769,7 @@ static inline struct task_struct *younger_sibling(struct task_struct *p)
#define thread_group_leader(p) (p->pid == p->tgid) #define thread_group_leader(p) (p->pid == p->tgid)
static inline void unhash_process(struct task_struct *p) extern 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);
}
/* Protects ->fs, ->files, ->mm, and synchronises with wait4(). Nests inside tasklist_lock */ /* Protects ->fs, ->files, ->mm, and synchronises with wait4(). Nests inside tasklist_lock */
static inline void task_lock(struct task_struct *p) static inline void task_lock(struct task_struct *p)
......
...@@ -27,6 +27,17 @@ extern struct task_struct *child_reaper; ...@@ -27,6 +27,17 @@ extern struct task_struct *child_reaper;
int getrusage(struct task_struct *, int, struct rusage *); 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) static void release_task(struct task_struct * p)
{ {
if (p == current) if (p == current)
...@@ -43,10 +54,16 @@ static void release_task(struct task_struct * p) ...@@ -43,10 +54,16 @@ static void release_task(struct task_struct * p)
current->cmaj_flt += p->maj_flt + p->cmaj_flt; current->cmaj_flt += p->maj_flt + p->cmaj_flt;
current->cnswap += p->nswap + p->cnswap; current->cnswap += p->nswap + p->cnswap;
sched_exit(p); sched_exit(p);
p->pid = 0;
put_task_struct(p); 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 * 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 * satisfactory pgrp is found. I dunno - gdb doesn't work correctly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment