diff options
-rw-r--r-- | include/linux/sched.h | 12 | ||||
-rw-r--r-- | kernel/exit.c | 4 | ||||
-rw-r--r-- | kernel/fork.c | 4 |
3 files changed, 6 insertions, 14 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index b4b14c32b28a..1f16fb1fea22 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1186,18 +1186,6 @@ extern void wait_task_inactive(task_t * p); | |||
1186 | #define remove_parent(p) list_del_init(&(p)->sibling) | 1186 | #define remove_parent(p) list_del_init(&(p)->sibling) |
1187 | #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) | 1187 | #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) |
1188 | 1188 | ||
1189 | #define REMOVE_LINKS(p) do { \ | ||
1190 | if (thread_group_leader(p)) \ | ||
1191 | list_del_init(&(p)->tasks); \ | ||
1192 | remove_parent(p); \ | ||
1193 | } while (0) | ||
1194 | |||
1195 | #define SET_LINKS(p) do { \ | ||
1196 | if (thread_group_leader(p)) \ | ||
1197 | list_add_tail(&(p)->tasks,&init_task.tasks); \ | ||
1198 | add_parent(p); \ | ||
1199 | } while (0) | ||
1200 | |||
1201 | #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) | 1189 | #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) |
1202 | #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) | 1190 | #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) |
1203 | 1191 | ||
diff --git a/kernel/exit.c b/kernel/exit.c index 5b5e8b67680e..f436a6bd3fb7 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -54,11 +54,13 @@ static void __unhash_process(struct task_struct *p) | |||
54 | if (thread_group_leader(p)) { | 54 | if (thread_group_leader(p)) { |
55 | detach_pid(p, PIDTYPE_PGID); | 55 | detach_pid(p, PIDTYPE_PGID); |
56 | detach_pid(p, PIDTYPE_SID); | 56 | detach_pid(p, PIDTYPE_SID); |
57 | |||
58 | list_del_init(&p->tasks); | ||
57 | if (p->pid) | 59 | if (p->pid) |
58 | __get_cpu_var(process_counts)--; | 60 | __get_cpu_var(process_counts)--; |
59 | } | 61 | } |
60 | 62 | ||
61 | REMOVE_LINKS(p); | 63 | remove_parent(p); |
62 | } | 64 | } |
63 | 65 | ||
64 | void release_task(struct task_struct * p) | 66 | void release_task(struct task_struct * p) |
diff --git a/kernel/fork.c b/kernel/fork.c index c49bd193b058..74c67629ee62 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1181,7 +1181,7 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1181 | */ | 1181 | */ |
1182 | p->ioprio = current->ioprio; | 1182 | p->ioprio = current->ioprio; |
1183 | 1183 | ||
1184 | SET_LINKS(p); | 1184 | add_parent(p); |
1185 | if (unlikely(p->ptrace & PT_PTRACED)) | 1185 | if (unlikely(p->ptrace & PT_PTRACED)) |
1186 | __ptrace_link(p, current->parent); | 1186 | __ptrace_link(p, current->parent); |
1187 | 1187 | ||
@@ -1191,6 +1191,8 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1191 | p->signal->session = current->signal->session; | 1191 | p->signal->session = current->signal->session; |
1192 | attach_pid(p, PIDTYPE_PGID, process_group(p)); | 1192 | attach_pid(p, PIDTYPE_PGID, process_group(p)); |
1193 | attach_pid(p, PIDTYPE_SID, p->signal->session); | 1193 | attach_pid(p, PIDTYPE_SID, p->signal->session); |
1194 | |||
1195 | list_add_tail(&p->tasks, &init_task.tasks); | ||
1194 | if (p->pid) | 1196 | if (p->pid) |
1195 | __get_cpu_var(process_counts)++; | 1197 | __get_cpu_var(process_counts)++; |
1196 | } | 1198 | } |