From: Yan Zheng <yanzheng@21cn.com>
To: linux-kernel@vger.kernel.org
Subject: Question about the usage of kernel_thread
Date: Sat, 05 Nov 2005 16:40:23 +0800 [thread overview]
Message-ID: <436C6FF7.4060206@21cn.com> (raw)
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
next reply other threads:[~2005-11-05 8:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-05 8:40 Yan Zheng [this message]
2005-11-05 11:31 ` Question about the usage of kernel_thread Fawad Lateef
2005-11-05 12:20 ` Yan Zheng
2005-11-05 12:54 ` Fawad Lateef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=436C6FF7.4060206@21cn.com \
--to=yanzheng@21cn.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox