I am little confused b/w workqueues and kthread when they are created as following-
Create kthread for each online CPU and bind to 1 unique CPU
for_each_online_cpu(cpu) {
kthread = kthread_create(func, ...);
kthread_bind(kthread, cpu);
}
//Each kthread will process work in serialized manner
Create BOUND workqueue for each online CPU with @max_active as 1
for_each_online_cpu() {
wq = alloc_workqueue(name, WQ_MEM_RECLAIM, 1)
}
// queue_work_on(cpu, work) will ensure the works queued on a particular CPU are
processed in a serialized manner.
Please let me know if my understanding is correct and what are the advantages of kthread over workqueues and vice-versa.
Thanks in advance.