]> err.no Git - linux-2.6/commitdiff
[PATCH] kill SET_LINKS/REMOVE_LINKS
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 29 Mar 2006 00:11:06 +0000 (16:11 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 29 Mar 2006 02:36:41 +0000 (18:36 -0800)
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 <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/sched.h
kernel/exit.c
kernel/fork.c

index b4b14c32b28a1d21e9a91c665feb1cfbac0e98d9..1f16fb1fea221af3b6072a7c687ceff94cde92f5 100644 (file)
@@ -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)
 
index 5b5e8b67680e0137d087d62e8a75da1de2594341..f436a6bd3fb7fb8b1c41c5b4cbc77636a64e4414 100644 (file)
@@ -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)
index c49bd193b058a2ff7e3e398c9c42fdc04baeef4c..74c67629ee6294cdbb2d6ab43f5d56b511d6ac2c 100644 (file)
@@ -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)++;
        }