admin管理员组文章数量:1387386
In linux/workqueue.h , there are pointers to system-wide workqueues.
The comment block details the individual properties.
(excerpt from workqueue.h, v6.13)
/*
* System-wide workqueues which are always present.
*
[...]
extern struct workqueue_struct *system_wq;
extern struct workqueue_struct *system_highpri_wq;
extern struct workqueue_struct *system_long_wq;
extern struct workqueue_struct *system_unbound_wq;
[...]
Many drivers I see make their own workqueue (in the probe function), then uses that for its tasks.
I was wondering when that is advantageous versus just sending the driver's tasks to one of the system queues, which are always there to use.
The only case I can see is wanting a single-thread queue so all my tasks run sequentially.
So when not wanting sequential task processing, what are arguments for making an own queue in probe()? Can I just use system queues for all stuff? What is the 'right' way of doing it?
In linux/workqueue.h , there are pointers to system-wide workqueues.
The comment block details the individual properties.
(excerpt from workqueue.h, v6.13)
/*
* System-wide workqueues which are always present.
*
[...]
extern struct workqueue_struct *system_wq;
extern struct workqueue_struct *system_highpri_wq;
extern struct workqueue_struct *system_long_wq;
extern struct workqueue_struct *system_unbound_wq;
[...]
Many drivers I see make their own workqueue (in the probe function), then uses that for its tasks.
I was wondering when that is advantageous versus just sending the driver's tasks to one of the system queues, which are always there to use.
The only case I can see is wanting a single-thread queue so all my tasks run sequentially.
So when not wanting sequential task processing, what are arguments for making an own queue in probe()? Can I just use system queues for all stuff? What is the 'right' way of doing it?
Share Improve this question edited Mar 18 at 14:23 Ian Abbott 17.8k1 gold badge21 silver badges37 bronze badges asked Mar 18 at 13:18 BlindleistungBlindleistung 7248 silver badges24 bronze badges 1- it may be useful for drivers that want to flush or drain their own workqueues. – Ian Abbott Commented Mar 18 at 14:48
1 Answer
Reset to default 1Excerpt from Linux Device Drivers, Third Edition, Chapter 7: Time, Delays, and Deferred Work
A device driver, in many cases, does not need its own workqueue. If you only submit tasks to the queue occasionally, it may be more efficient to simply use the shared, default workqueue that is provided by the kernel. If you use this queue, however, you must be aware that you will be sharing it with others. Among other things, that means that you should not monopolize the queue for long periods of time (no long sleeps), and it may take longer for your tasks to get their turn in the processor.
Otherwise, it may be better to create your own workqueue.
本文标签: Linux kernel workqueue Own queue versus systemwqStack Overflow
版权声明:本文标题:Linux kernel workqueue: Own queue versus system_wq? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744512241a2609951.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论