Linux 6.5 Workqueues Add Automatic CPU-Intensive Detection & Monitoring
Tejun Heo last week submitted the workqueue changes for the Linux 6.5 kernel and they include an interesting addition.
The workqueue code for Linux 6.5 adds automayic CPU intensive detection and monitoring. The patch series from Tejun that's been ongoing for several months explains:
So now with Linux 6.5 these heavy per-CPU work items will be excluded from concurrency management in order to avoid delaying the execution of other work items.
More details on this workqueues change for Linux 6.5 via this pull.
The workqueue code for Linux 6.5 adds automayic CPU intensive detection and monitoring. The patch series from Tejun that's been ongoing for several months explains:
"To support per-cpu work items that may occupy the CPU for a substantial period of time, workqueue has WQ_CPU_INTENSIVE flag which exempts work items issued through the marked workqueue from concurrency management - they're started immediately and don't block other work items. While this works, it's error-prone in that a workqueue user can easily forget to set the flag or set it unnecessarily. Furthermore, the impacts of the wrong flag setting can be rather indirect and challenging to root-cause.
This patchset makes workqueue auto-detect CPU intensive work items based on CPU consumption. If a work item consumes more than the threshold (10ms by default) of CPU time, it's automatically marked as CPU intensive when it gets scheduled out which unblocks starting of pending per-cpu work items.
The mechanism isn't foolproof in that the detection delays can add up if many CPU-hogging work items are queued at the same time. However, in such situations, the bigger problem likely is the CPU being saturated with per-cpu work items and the solution would be making them UNBOUND. Future changes will make UNBOUND workqueues more attractive by improving their locality behaviors and configurability. We might eventually remove the explicit WQ_CPU_INTENSIVE flag."
So now with Linux 6.5 these heavy per-CPU work items will be excluded from concurrency management in order to avoid delaying the execution of other work items.
More details on this workqueues change for Linux 6.5 via this pull.
5 Comments