[PATCH rc1-mm] kill SET_LINKS/REMOVE_LINKS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(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]>

--- RC-1/include/linux/sched.h~0_LINKS	2006-02-04 23:48:15.000000000 +0300
+++ RC-1/include/linux/sched.h	2006-02-04 23:50:54.000000000 +0300
@@ -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)
 
--- RC-1/kernel/fork.c~0_LINKS	2006-02-04 23:31:47.000000000 +0300
+++ RC-1/kernel/fork.c	2006-02-04 23:43:16.000000000 +0300
@@ -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)++;
 	}
--- RC-1/kernel/exit.c~0_LINKS	2006-02-04 23:31:47.000000000 +0300
+++ RC-1/kernel/exit.c	2006-02-04 23:45:14.000000000 +0300
@@ -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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux