kthread: Don't looking for a task in create_kthread() #2
authorVitaliy Gusev <vgusev@openvz.org>
Thu, 9 Apr 2009 15:50:35 +0000 (09:50 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 9 Apr 2009 00:20:36 +0000 (09:50 +0930)
Remove the unnecessary find_task_by_pid_ns(). kthread() can just
use "current" to get the same result.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/kthread.c

index 84bbadd4d0213c1558ade617ab49695df0b1bd9f..c013bf000ce673b2f80cba06a68ab0b3a69cced3 100644 (file)
@@ -76,6 +76,7 @@ static int kthread(void *_create)
 
        /* OK, tell user we're spawned, wait for stop or wakeup */
        __set_current_state(TASK_UNINTERRUPTIBLE);
+       create->result = current;
        complete(&create->started);
        schedule();
 
@@ -101,9 +102,6 @@ static void create_kthread(struct kthread_create_info *create)
        } else {
                struct sched_param param = { .sched_priority = 0 };
                wait_for_completion(&create->started);
-               read_lock(&tasklist_lock);
-               create->result = find_task_by_pid_ns(pid, &init_pid_ns);
-               read_unlock(&tasklist_lock);
                /*
                 * root may have changed our (kthreadd's) priority or CPU mask.
                 * The kernel thread should not inherit these properties.