Re: [PATCHSET wq/for-6.9] workqueue: Implement BH workqueue and convert several tasklet users
From: Sebastian Andrzej Siewior
Date: Tue Jan 30 2024 - 05:20:35 EST
On 2024-01-29 23:11:47 [-1000], Tejun Heo wrote:
> Hello,
Hi,
> As suggested, this patchset implements BH workqueues which are like regular
> workqueues but executes work items in the BH (softirq) context and converts
> several tasklet users.
>
> - The name bh is used instead of the suggested atomic as it's more in line
> with widely used execution context interface - local_bh_enable/disable()
> and friends.
>
> - The system default BH workqueues - system_bh_wq and system_bh_highpri_wq -
> are provided. As queue-wide flushing doesn't exist in tasklet, all
> existing tasklet users should be able to use the system BH workqueues
> without creating their own.
>
> - BH workqueues currently use tasklet to run the work items to avoid
> priority inversions involving tasklet_hi and WQ_BH | WQ_HIGHPRI. Once all
> tasklet users are converted, tasklet code can be removed and BH workqueues
> can take over its softirqs.
If one context creates multiple work item which are then moved to
tasklet I don't see the difference vs workqueue with a bh_disable()
around it.
Looking at the USB changes, I would prefer to see it converted to
threaded interrupts instead of using tasklet or workqueue. Both
approaches (current tasklet, suggested workqueue) lose the original
context where the request was created. Having threaded interrupts would
allow to keep everything in the same "context" so you could prioritize
according to your needs.
Sebastian