lkml.org 
[lkml]   [2007]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kthread: Don't depend on work queues (take 2)
On 04/11, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@tv-sign.ru> writes:
>
> > On 04/11, Eric W. Biederman wrote:
> >>
> >> @@ -435,8 +436,12 @@ static void __init setup_command_line(char *command_line)
> >> static void noinline rest_init(void)
> >> __releases(kernel_lock)
> >> {
> >> + int pid;
> >> kernel_thread(init, NULL, CLONE_FS | CLONE_SIGHAND);
> >> numa_default_policy();
> >> +
> >> + pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
> >> + kthreadd_task = find_task_by_pid(pid);
> >> unlock_kernel();
> >
> > Just curious. What if kernel/kthread.c declares
> >
> > static struct task_struct *kthreadd_task = &init_task;
> >
> > an then kthreadd_setup() does kthreadd_task = current. I assume it is always
> > safe to try_to_wake_up(idle_thread), because it always TASK_RUNNING. This
> > way we don't need to export kthreadd_task.
>
> I did it this way largely so I could use the export in reparent_to_XXX in
> daemonize. This way I don't have races in finding kthreadd. Plus
> I didn't think of the trick of using the idle_thread...

Ah yes, we still need to export kthreadd_task... I just worried about subtle
dependency this patch adds... This "kthreadd_task = find_task_by_pid" assumes
that init/main.c:init() takes lock_kernel() before the first kthread_create().

Oleg.

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

\
 
 \ /
  Last update: 2007-04-11 21:53    [W:0.717 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site