[PATCH 0/1] kthreads: simplify !kthreadd_task logic, killkthreadd_task_init_done

From: Oleg Nesterov
Date: Tue Sep 01 2009 - 12:58:25 EST


On 09/01, Oleg Nesterov wrote:
>
> On 09/01, Ingo Molnar wrote:
> >
> > * Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > > On 09/01, Ingo Molnar wrote:
> > > >
> > > > * Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> > > >
> > > > > Yes, this should work. But I _think_ we can make the better fix...
> > > > >
> > > > > I'll try to make the patch soon. Afaics we don't need
> > > > > kthreadd_task_init_done.
> > > >
> > > > ok.
> > >
> > > Just in case, the patch is ready. [...]
> >
> > yes - that's roughly the cleanup i referred to in the commit log.
> >
> > way too late for -rc8 though - the minimal fix i did _might_ be
> > eligible.
> >
> > agreed?
>
> Agreed. Then I will sent the patch on top of this change.

OK, I am sending the patch on top of your fix. Not sure how to really
test it, but at least the kernel works when I apply the debugging patch
below on top.

Oleg.

--- WAIT/init/main.c~DBG 2009-09-01 15:49:36.000000000 +0200
+++ WAIT/init/main.c 2009-09-01 17:53:28.000000000 +0200
@@ -455,7 +455,6 @@ static noinline void __init_refok rest_i
{
kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
- kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
unlock_kernel();

/*
@@ -466,6 +465,12 @@ static noinline void __init_refok rest_i
rcu_scheduler_starting();
preempt_enable_no_resched();
schedule();
+
+ printk(KERN_INFO "XXX rest_init - sleeeeep\n");
+// schedule_timeout_interruptible(HZ);
+ kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
+ printk(KERN_INFO "XXX rest_init - kthreadd started\n");
+
preempt_disable();

/* Call into cpu_idle with preempt disabled */
@@ -877,10 +882,18 @@ static noinline int init_post(void)
panic("No init found. Try passing init= option to kernel.");
}

+int ktfunc(void *arg)
+{
+ printk(KERN_INFO "XXX ktfunc - alive!\n");
+ return 0;
+}
+
static int __init kernel_init(void * unused)
{
lock_kernel();

+ printk(KERN_INFO "XXX kernel_init - call kthread_run, kthreadd=%p\n", kthreadd_task);
+ kthread_run(ktfunc, NULL, "xxx");
/*
* init can allocate pages on any node
*/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/