From: Vitaliy Gusev Date: Thu, 9 Apr 2009 15:50:35 +0000 (-0600) Subject: kthread: Don't looking for a task in create_kthread() #2 X-Git-Tag: firefly_0821_release~14561^2~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3217ab97f14c5c8f9f975ed8c40c351164b0b10e;p=firefly-linux-kernel-4.4.55.git kthread: Don't looking for a task in create_kthread() #2 Remove the unnecessary find_task_by_pid_ns(). kthread() can just use "current" to get the same result. Signed-off-by: Vitaliy Gusev Acked-by: Oleg Nesterov Signed-off-by: Rusty Russell --- diff --git a/kernel/kthread.c b/kernel/kthread.c index 84bbadd4d021..c013bf000ce6 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -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.