All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about the usage of kernel_thread
@ 2005-11-05  8:40 Yan Zheng
  2005-11-05 11:31 ` Fawad Lateef
  0 siblings, 1 reply; 4+ messages in thread
From: Yan Zheng @ 2005-11-05  8:40 UTC (permalink / raw)
  To: linux-kernel

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



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

end of thread, other threads:[~2005-11-05 12:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-05  8:40 Question about the usage of kernel_thread Yan Zheng
2005-11-05 11:31 ` Fawad Lateef
2005-11-05 12:20   ` Yan Zheng
2005-11-05 12:54     ` Fawad Lateef

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.