lkml.org 
[lkml]   [2005]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQuestion about the usage of kernel_thread
Hi.

In LKD2, Robert say:
Linux delegates several tasks to kernel threads, most notably the pdflush task and the ksoftirqd task. These threads are created on system boot by other kernel threads. Indeed, a kernel thread can be created only by another kernel thread.


But I found that kernel_thread(...) are used wildly like:

#include <linux/kernel.h>
#include <linux/module.h>

static int noop(void *dummy)
{
printk("current->mm = %p\n", current->mm);
return 0;
}

static int test_init(void)
{
kernel_thread(noop, NULL, CLONE_KERNEL | SIGCHLD);
return 0;
}

static void test_exit(void) {}
module_init(test_init);
module_exit(test_exit);


In this circumstances, The thread created by kernel_thread has "current->mm != NULL".

My question is:
The new thread is truely kernel thread ? The usage of kernel_thread(...) like this is correct?

Thanks advance.
Best Regards


-
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: 2005-11-05 09:41    [W:0.249 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site