[PATCH v3 0/2] workqueue: Add warnings and check WQ flags usage
From: Marco Crivellari
Date: Thu May 28 2026 - 12:17:15 EST
Hi,
Currently system_wq and system_unbound_wq can still be used and no message
is printed. To avoid further use of them, add a warning. The detection of
deprecated workqueue is done using a new internal flag, called __WQ_DEPRECATED.
Similar scenario for WQ_PERCPU and WQ_UNBOUND. Currently there are still
users that use alloc_workqueue(,0,). To avoid such situations, a couple
of checks have been added:
- if neither of the flag is present, set WQ_PERCPU
- if both are present, remove WQ_PERCPU
Along with these, a warning will be printed.
Thanks!
Marco Crivellari (2):
workqueue: Add warnings and fallback if system_{unbound}_wq is used
workqueue: Add warnings and ensure one among WQ_PERCPU or WQ_UNBOUND
is present
include/linux/workqueue.h | 1 +
kernel/workqueue.c | 31 ++++++++++++++++++++++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
---
Changes in v3:
- system_wq / system_unbond_wq not routed to the newer. The warnings have been simpliified
keeping only one of them inside __queue_work() printing the work function.
- the deprecated status is detected using a new internal flag, called __WQ_DEPRECATED.
Link to v2: https://lore.kernel.org/all/20260526150041.365392-1-marco.crivellari@xxxxxxxx/
Changes in v2:
- rebased on v7.1-rc5
- fixed typo in the text
- cleared WQ_PERCPU when wq_pwer_efficient flag is set, to avoid triggering a warning
- if statement to route old workqueue to newer also added in queue_rcu_work()
Link to v1: https://lore.kernel.org/all/20260514092354.125149-1-marco.crivellari@xxxxxxxx/
--
2.54.0