|author||Eric W. Biederman <firstname.lastname@example.org>||2007-05-09 02:34:33 -0700|
|committer||Linus Torvalds <email@example.com>||2007-05-09 12:30:53 -0700|
Change reparent_to_init to reparent_to_kthreadd
When a kernel thread calls daemonize, instead of reparenting the thread to init reparent the thread to kthreadd next to the threads created by kthread_create. This is really just a stop gap until daemonize goes away, but it does ensure no kernel threads are under init and they are all in one place that is easy to find. Signed-off-by: Eric W. Biederman <firstname.lastname@example.org> Cc: Oleg Nesterov <email@example.com> Signed-off-by: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com>
Diffstat (limited to 'kernel/exit.c')
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index f5a7abb621f..bc982cd7274 100644
@@ -26,6 +26,7 @@
@@ -254,26 +255,25 @@ static int has_stopped_jobs(struct pid *pgrp)
- * reparent_to_init - Reparent the calling kernel thread to the init task of the pid space that the thread belongs to.
+ * reparent_to_kthreadd - Reparent the calling kernel thread to kthreadd
* If a kernel thread is launched as a result of a system call, or if
- * it ever exits, it should generally reparent itself to init so that
- * it is correctly cleaned up on exit.
+ * it ever exits, it should generally reparent itself to kthreadd so it
+ * isn't in the way of other processes and is correctly cleaned up on exit.
* The various task state such as scheduling policy and priority may have
* been inherited from a user process, so we reset them to sane values here.
- * NOTE that reparent_to_init() gives the caller full capabilities.
+ * NOTE that reparent_to_kthreadd() gives the caller full capabilities.
-static void reparent_to_init(void)
+static void reparent_to_kthreadd(void)
/* Reparent to init */
- current->parent = child_reaper(current);
- current->real_parent = child_reaper(current);
+ current->real_parent = current->parent = kthreadd_task;
/* Set the exit signal to SIGCHLD so we signal init on exit */
@@ -400,7 +400,7 @@ void daemonize(const char *name, ...)
current->files = init_task.files;