From a923d368290c27bcffca60c6f9756a1f78a6c10c Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Tue, 28 Mar 2006 16:11:06 -0800 Subject: [PATCH] --- yaml --- r: 24549 b: refs/heads/master c: c97d98931ac52ef110b62d9b75c6a6f2bfbc1898 h: refs/heads/master i: 24547: d058693930f4b8a0c8aa2c70088279fab0ca5174 v: v3 --- [refs] | 2 +- trunk/include/linux/sched.h | 12 ------------ trunk/kernel/exit.c | 4 +++- trunk/kernel/fork.c | 4 +++- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index f275abed2e91..e15feac58613 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9b678ece42893b53aae5ed7cb8d7cb261cacb72c +refs/heads/master: c97d98931ac52ef110b62d9b75c6a6f2bfbc1898 diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index b4b14c32b28a..1f16fb1fea22 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1186,18 +1186,6 @@ extern void wait_task_inactive(task_t * p); #define remove_parent(p) list_del_init(&(p)->sibling) #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) -#define REMOVE_LINKS(p) do { \ - if (thread_group_leader(p)) \ - list_del_init(&(p)->tasks); \ - remove_parent(p); \ - } while (0) - -#define SET_LINKS(p) do { \ - if (thread_group_leader(p)) \ - list_add_tail(&(p)->tasks,&init_task.tasks); \ - add_parent(p); \ - } while (0) - #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 5b5e8b67680e..f436a6bd3fb7 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -54,11 +54,13 @@ static void __unhash_process(struct task_struct *p) if (thread_group_leader(p)) { detach_pid(p, PIDTYPE_PGID); detach_pid(p, PIDTYPE_SID); + + list_del_init(&p->tasks); if (p->pid) __get_cpu_var(process_counts)--; } - REMOVE_LINKS(p); + remove_parent(p); } void release_task(struct task_struct * p) diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index c49bd193b058..74c67629ee62 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -1181,7 +1181,7 @@ static task_t *copy_process(unsigned long clone_flags, */ p->ioprio = current->ioprio; - SET_LINKS(p); + add_parent(p); if (unlikely(p->ptrace & PT_PTRACED)) __ptrace_link(p, current->parent); @@ -1191,6 +1191,8 @@ static task_t *copy_process(unsigned long clone_flags, p->signal->session = current->signal->session; attach_pid(p, PIDTYPE_PGID, process_group(p)); attach_pid(p, PIDTYPE_SID, p->signal->session); + + list_add_tail(&p->tasks, &init_task.tasks); if (p->pid) __get_cpu_var(process_counts)++; }