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?
Excerpt 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.