kill SET_LINKS/REMOVE_LINKS
Subsystems (3)
PATCH 1/1 kill SET_LINKS/REMOVE_LINKS
(Andrew, this patch can't be applied to the current -mm tree,
I have sent you updated pidhash 1-3 patches which should go after this patch)
Depends on these patches:
remove-add_parents-parent-argument.patch dont-use-remove_links-set_links-for-reparenting.patch
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 <[email protected]>
include/linux/sched.h renamed from include/linux/sched.h~0_LINKS +0 -12
@@ -1177,18 +1177,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)
kernel/fork.c renamed from kernel/fork.c~0_LINKS +3 -1
@@ -1131,7 +1131,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);
@@ -1143,6 +1143,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)++; }
kernel/exit.c renamed from kernel/exit.c~0_LINKS +3 -1
@@ -52,11 +52,13 @@ static void __unhash_process(struct taskif (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)