From: Oleg Nesterov Both SET_LINKS() and SET_LINKS/REMOVE_LINKS() have exactly one caller, and these callers already check thread_group_leader(). This patch kills theese macros, they mix two different things: setting process's parent and registering it in init_task.tasks list. Callers are updated to do these actions by hand. Signed-off-by: Oleg Nesterov Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton --- include/linux/sched.h | 12 ------------ kernel/exit.c | 4 +++- kernel/fork.c | 4 +++- 3 files changed, 6 insertions(+), 14 deletions(-) diff -puN include/linux/sched.h~kill-set_links-remove_links include/linux/sched.h --- devel/include/linux/sched.h~kill-set_links-remove_links 2006-02-27 20:58:31.000000000 -0800 +++ devel-akpm/include/linux/sched.h 2006-02-27 20:58:31.000000000 -0800 @@ -1180,18 +1180,6 @@ extern void wait_task_inactive(task_t * #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 -puN kernel/exit.c~kill-set_links-remove_links kernel/exit.c --- devel/kernel/exit.c~kill-set_links-remove_links 2006-02-27 20:58:31.000000000 -0800 +++ devel-akpm/kernel/exit.c 2006-02-27 20:58:31.000000000 -0800 @@ -52,11 +52,13 @@ static void __unhash_process(struct task 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 -puN kernel/fork.c~kill-set_links-remove_links kernel/fork.c --- devel/kernel/fork.c~kill-set_links-remove_links 2006-02-27 20:58:31.000000000 -0800 +++ devel-akpm/kernel/fork.c 2006-02-27 20:58:31.000000000 -0800 @@ -1171,7 +1171,7 @@ static task_t *copy_process(unsigned lon */ p->ioprio = current->ioprio; - SET_LINKS(p); + add_parent(p); if (unlikely(p->ptrace & PT_PTRACED)) __ptrace_link(p, current->parent); @@ -1181,6 +1181,8 @@ static task_t *copy_process(unsigned lon 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)++; } _