[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090918211218.GA19351@redhat.com>
Date: Fri, 18 Sep 2009 23:12:18 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Wu Fei <at.wufei@...il.com>, Ingo Molnar <mingo@...e.hu>,
"Eric W. Biederman" <ebiederm@...ssion.com>, arjan@...radead.org,
jeremy@...p.org, mschmidt@...hat.com, mingo@...hat.com,
hpa@...or.com, linux-kernel@...r.kernel.org, tj@...nel.org,
tglx@...utronix.de, Andrew Morton <akpm@...ux-foundation.org>,
linux-tip-commits@...r.kernel.org,
Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH 0/1] kthreads: simplify !kthreadd_task logic, kill
kthreadd_task_init_done
On 09/18, Linus Torvalds wrote:
>
> On Fri, 18 Sep 2009, Oleg Nesterov wrote:
> > > rcu_scheduler_starting();
> > > - kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
> > > - numa_default_policy();
> > > pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
> > > kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
> > > + kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
> >
> > We can't do this. kernel_init() should run with ->pid == 1, we are
> > going to exec /sbin/init.
>
> Umm - why not just add CLONE_PID to the 'kthreadd' creation, then?
Not sure I understand... We don't have CLONE_PID, and kthreadd()
shouldn't have pid == 0 anyway.
But this is not needed. We can do alloc_pid() before 'kthreadd' creation,
then free_pid() before kernel_thread(kernel_init).
However, I am not sure we should do something like this. The patch
I sent is very simple, in essence it is one-liner which only does
- wake_up_process(kthreadd_task);
+ if (kthreadd_task)
+ wake_up_process(kthreadd_task);
this way we should not worry about the ordering, kthread_create()
can be called at any time, even before kthreadd creation (not that
I think this is really useful though).
But personally I still can't understand what happens. If we were
preempted somewhere before "kthreadd_task = find_task_by_pid_ns()"
initialization, then schedule_debug() should complain? rest_init()
runs under preempt_disable().
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists