在include/linux/kthread.h里有如下的宏定义,用来创建和唤醒一个线程
/**
18 * kthread_run - create and wake a thread.
19 * @threadfn: the function to run until signal_pending(current).
20 * @data: data ptr for @threadfn.
21 * @namefmt: printf-style name for the thread.
22 *
23 * Description: Convenient wrapper for kthread_create() followed by
24 * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
25 */
26#define kthread_run(threadfn, data, namefmt, ...) \
27({ \
28 struct task_struct *__k \
29 = kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \
30 if (!IS_ERR(__k)) \
31 wake_up_process(__k); \
32 __k; \
33})