kthread
2016-04-05 22:22
218 查看
kernel/init/main.c static noinline void __init_refok rest_init(void) { ... pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES); .. kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns); ... } kthreadd_task 实际对应 kthreadd kernel/kthread.c struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), void *data, int node, const char namefmt[], ...) { ... wake_up_process(kthreadd_task); ... } 唤醒 kthread_task,实际就是kthreadd函数执行: #define kthread_create(threadfn, data, namefmt, arg...) \ kthread_create_on_node(threadfn, data, -1, namefmt, ##arg) /** * kthread_run - create and wake a thread. * @threadfn: the function to run until signal_pending(current). * @data: data ptr for @threadfn. * @namefmt: printf-style name for the thread. * * Description: Convenient wrapper for kthread_create() followed by * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM). */ #define kthread_run(threadfn, data, namefmt, ...) \ ({ \ struct task_struct *__k \ = kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \ if (!IS_ERR(__k)) \ wake_up_process(__k); \ __k; \ })
相关文章推荐
- JAVA学习之必备知识点琐碎(一)
- 第三章:表达式与运算符
- Python Twisted架构英文版
- 第四次作业:文件的复制速度
- 基于ZooKeeper的服务注册中心
- 经典矩阵问题
- jsp常用跳转方式
- 创建Android虚拟机
- Java Decorator
- 数据结构之栈(2)——多栈共享技术
- 4_6 师兄帮帮忙(UVa12412)(选做)
- 用Java实现线性表的顺序存储结构
- error C2265: '<Unknown>' : reference to a zero-sized array is illegal
- [查异常网]-20160405-我们到底为了什么钻研技术?
- 图解VC++工具栏和状态栏编程实例
- 上升子序列
- 2015 牌型种数
- PCIE BAR空间
- iOS 音频开发经验汇总
- struts2笔记11-OGNL