mirror-linux/drivers/usb/core
Marco Crivellari e91bbe0828 USB: add WQ_PERCPU to alloc_workqueue users
Currently if a user enqueues a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.
This lack of consistency cannot be addressed without refactoring the API.

alloc_workqueue() treats all queues as per-CPU by default, while unbound
workqueues must opt-in via WQ_UNBOUND.

This default is suboptimal: most workloads benefit from unbound queues,
allowing the scheduler to place worker threads where they’re needed and
reducing noise when CPUs are isolated.

This continues the effort to refactor workqueue APIs, which began with
the introduction of new workqueues and a new alloc_workqueue flag in:

commit 128ea9f6cc ("workqueue: Add system_percpu_wq and system_dfl_wq")
commit 930c2ea566 ("workqueue: Add new WQ_PERCPU flag")

This change adds a new WQ_PERCPU flag to explicitly request
alloc_workqueue() to be per-cpu when WQ_UNBOUND has not been specified.

With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND),
any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND
must now use WQ_PERCPU.

Once migration is complete, WQ_UNBOUND can be removed and unbound will
become the implicit default.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://patch.msgid.link/20251107153737.301413-2-marco.crivellari@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-21 15:17:36 +01:00
..
Kconfig usb: core: Kconfig: Improve USB authorization mode help 2024-02-17 16:38:35 +01:00
Makefile usb: core: Add tracepoints for device allocation and state changes 2025-10-22 10:58:30 +02:00
buffer.c
config.c usb: core: eUSB2 companion descriptor is for isoc IN endpoints only 2025-09-06 15:25:05 +02:00
devices.c USB: Remove remnants of Wireless USB and UWB 2023-08-09 14:17:06 +02:00
devio.c USB: core: remove dead code in do_proc_bulk() 2024-11-13 07:06:41 +01:00
driver.c Merge 6.17-rc6 into usb-next 2025-09-15 08:18:40 +02:00
endpoint.c usb: core: use sysfs_emit() instead of sprintf() 2024-10-29 04:33:49 +01:00
file.c USB: make usb class a const structure 2023-07-25 17:49:30 +02:00
generic.c USB: lower "Device is not authorized for usage" message to info 2025-08-13 16:55:27 +02:00
hcd-pci.c usb: core: modify comments xhci_hc_driver has HCD_MEMORY just like ehci ohci 2025-06-19 12:31:16 +02:00
hcd.c usb: core: Drop spaces after function names 2025-10-13 09:11:48 +02:00
hub.c USB: add WQ_PERCPU to alloc_workqueue users 2025-11-21 15:17:36 +01:00
hub.h usb: hub: Fix flushing of delayed work used for post resume purposes 2025-06-30 15:36:00 +02:00
ledtrig-usbport.c usb: core: use sysfs_emit() instead of sprintf() 2024-10-29 04:33:49 +01:00
message.c USB: Fix descriptor count when handling invalid MBIM extended descriptor 2025-10-13 09:34:16 +02:00
notify.c
of.c usb: core: add missing of_node_put() in usb_of_has_devices_or_graph 2024-07-03 16:04:10 +02:00
offload.c usb: offload: add apis for offload usage tracking 2025-09-12 14:08:02 +02:00
otg_productlist.h
phy.c usb: core: add phy notify connect and disconnect 2024-01-27 17:36:14 -08:00
phy.h usb: core: add phy notify connect and disconnect 2024-01-27 17:36:14 -08:00
port.c USB: Use str_enable_disable-like helpers 2025-01-15 18:28:13 +01:00
quirks.c usb/core/quirks: Add Huawei ME906S to wakeup quirk 2025-10-22 10:00:57 +02:00
sysfs.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
trace.c usb: core: Add tracepoints for device allocation and state changes 2025-10-22 10:58:30 +02:00
trace.h usb: core: Add tracepoints for device allocation and state changes 2025-10-22 10:58:30 +02:00
urb.c usb: core: support eUSB2 double bandwidth large isoc URB frames 2025-09-06 15:25:05 +02:00
usb-acpi.c usb: acpi: fix device link removal 2025-06-19 12:36:19 +02:00
usb.c usb: core: Add tracepoints for device allocation and state changes 2025-10-22 10:58:30 +02:00
usb.h USB: make to_usb_device_driver() use container_of_const() 2024-11-14 17:57:33 +01:00