1. 会创建线程的worqueue
wq = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM | WQ_HIGHPRI, "f_fstb"); //prio=100 cfs 0-7 # ps -AT | grep f_fstb root 645 645 2 0 0 rescuer_thread 0 I f_fstb wq = create_singlethread_workqueue("s_async"); //prio=100 cfs 0-7 # ps -AT | grep s_async root 300 300 2 0 0 rescuer_thread 0 I s_async
2. kworker线程的名称为:kworker/%u:%d%s
u:是 unbound 的缩写,代表没有绑定特定的CPU,kworker/u2:0 中的 2 是 work_pool 的ID。不带u的就是绑定特定cpu的workerq,它在 init_workqueues 中初始化,给每个cpu分配worker,如果该worker的nice小于0,说明它的优先级很高,所以就加了H属性。具有负面价值的勤劳工人的名字后缀为'H'。根据kernel.org,语法为 kworker/%u:%d%s (cpu, id, priority)。 若是u的话表示未绑定cpu。参考:https://lkml.org/lkml/2013/3/19/661
root 3486 3486 2 0 0 worker_thread 0 I kworker/4:2H-kblockd root 9254 9254 2 0 0 worker_thread 0 I kworker/6:1-pm root 19682 19682 2 0 0 worker_thread 0 I kworker/0:1H-events_highpri root 20022 20022 2 0 0 worker_thread 0 I kworker/u16:0-kverityd root 21229 21229 2 0 0 worker_thread 0 I kworker/u17:3-mali_kbase_csf_sync_upd