public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kthread: Don't looking for a task in create_kthread()
@ 2009-01-19 17:28 Vitaliy Gusev
  2009-01-19 19:03 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaliy Gusev @ 2009-01-19 17:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Hellwig, Oleg Nesterov, linux-kernel, Pavel Emelyanov

Let a process fill result, as 'current' is the same
in all pid namespaces.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>

---
 kernel/kthread.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 4fbc456..fd765f9 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.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kthread: Don't looking for a task in create_kthread()
  2009-01-19 17:28 [PATCH] kthread: Don't looking for a task in create_kthread() Vitaliy Gusev
@ 2009-01-19 19:03 ` Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2009-01-19 19:03 UTC (permalink / raw)
  To: Vitaliy Gusev
  Cc: Andrew Morton, Christoph Hellwig, linux-kernel, Pavel Emelyanov

On 01/19, Vitaliy Gusev wrote:
>
> Let a process fill result, as 'current' is the same
> in all pid namespaces.

This looks like a very nice patch to me.

But I don't understand the changelog. Afaics, this has nothing to do
with namespaces. We can remove the unnecessary find_task_by_pid_ns()
kthread() can just use "current" to get the same result.

Could you please improve the changelog and re-send?

Oleg.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-19 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19 17:28 [PATCH] kthread: Don't looking for a task in create_kthread() Vitaliy Gusev
2009-01-19 19:03 ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox