]> git.hungrycats.org Git - linux/commitdiff
Cleanup: use list macros for task list
authorLinus Torvalds <torvalds@home.transmeta.com>
Fri, 15 Mar 2002 06:30:56 +0000 (22:30 -0800)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Fri, 15 Mar 2002 06:30:56 +0000 (22:30 -0800)
arch/i386/kernel/smpboot.c
include/linux/init_task.h
include/linux/sched.h
kernel/exit.c

index 34b0d8ac6f9a14ea49da27dfd55b8cedfefd3b0e..55bc246bf5abc98f814e0326e61b59e3f77c79a1 100644 (file)
@@ -828,7 +828,7 @@ static void __init do_boot_cpu (int apicid)
         * We remove it from the pidhash and the runqueue
         * once we got the process:
         */
-       idle = init_task.prev_task;
+       idle = prev_task(&init_task);
        if (!idle)
                panic("No idle process for CPU %d", cpu);
 
index 5f0f74653fdaf36d39a190b4c529e508918be0cd..98951775c26752563f4084f33e39a47f7a7baedb 100644 (file)
@@ -53,8 +53,7 @@
     active_mm:         &init_mm,                                       \
     run_list:          LIST_HEAD_INIT(tsk.run_list),                   \
     time_slice:                HZ,                                             \
-    next_task:         &tsk,                                           \
-    prev_task:         &tsk,                                           \
+    tasks:             LIST_HEAD_INIT(tsk.tasks),                      \
     real_parent:       &tsk,                                           \
     parent:            &tsk,                                           \
     children:          LIST_HEAD_INIT(tsk.children),                   \
index 009436ba5de6d24a73440f2e25fdc9dd0cebc74e..205c801bea22a8da2bc02d14c33e2a5fd345895c 100644 (file)
@@ -250,7 +250,7 @@ struct task_struct {
        unsigned long cpus_allowed;
        unsigned int time_slice;
 
-       struct task_struct *next_task, *prev_task;
+       struct list_head tasks;
 
        struct mm_struct *mm, *active_mm;
        struct list_head local_pages;
@@ -718,18 +718,17 @@ do {                                                                      \
        __ret;                                                          \
 })
 
+#define remove_parent(p)       list_del_init(&(p)->sibling)
+#define add_parent(p, parent)  list_add_tail(&(p)->sibling,&(parent)->children)
+
 #define REMOVE_LINKS(p) do {                           \
-       (p)->next_task->prev_task = (p)->prev_task;     \
-       (p)->prev_task->next_task = (p)->next_task;     \
-       list_del_init(&(p)->sibling);                   \
+       list_del_init(&(p)->tasks);                     \
+       remove_parent(p);                               \
        } while (0)
 
-#define SET_LINKS(p) do {                                      \
-       (p)->next_task = &init_task;                            \
-       (p)->prev_task = init_task.prev_task;                   \
-       init_task.prev_task->next_task = (p);                   \
-       init_task.prev_task = (p);                              \
-       list_add_tail(&(p)->sibling,&(p)->parent->children);    \
+#define SET_LINKS(p) do {                              \
+       list_add_tail(&(p)->tasks,&init_task.tasks);    \
+       add_parent(p, (p)->parent);                     \
        } while (0)
 
 static inline struct task_struct *eldest_child(struct task_struct *p)
@@ -756,8 +755,11 @@ static inline struct task_struct *younger_sibling(struct task_struct *p)
        return list_entry(p->sibling.next,struct task_struct,sibling);
 }
 
+#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)
+
 #define for_each_task(p) \
-       for (p = &init_task ; (p = p->next_task) != &init_task ; )
+       for (p = &init_task ; (p = next_task(p)) != &init_task ; )
 
 #define for_each_thread(task) \
        for (task = next_thread(current) ; task != current ; task = next_thread(task))
index 4410c1405ea5f636e5e1bc2249f9efd22dd491cf..ac0bd045fb10f157c377cdf1995f4cc19d8afc1f 100644 (file)
@@ -612,9 +612,9 @@ repeat:
                                retval = p->pid;
                                if (p->real_parent != p->parent) {
                                        write_lock_irq(&tasklist_lock);
-                                       REMOVE_LINKS(p);
+                                       remove_parent(p);
                                        p->parent = p->real_parent;
-                                       SET_LINKS(p);
+                                       add_parent(p, p->parent);
                                        do_notify_parent(p, SIGCHLD);
                                        write_unlock_irq(&tasklist_lock);
                                } else