The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Marco Crivellari <marco.crivellari@suse.com>
Cc: linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH v2 3/4] Workqueue: WQ_PERCPU added to all the remaining users
Date: Mon, 25 Aug 2025 15:55:00 +0200	[thread overview]
Message-ID: <aKxrNPfjjACwqSAa@localhost.localdomain> (raw)
In-Reply-To: <20250825132906.1050437-4-marco.crivellari@suse.com>

Le Mon, Aug 25, 2025 at 03:29:05PM +0200, Marco Crivellari a écrit :
> Currently if a user enqueue 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 consistentcy 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 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 patch adds a new WQ_PERCPU flag to explicitly request the use of
> the per-CPU behavior. Both flags coexist for one release cycle to allow
> callers to transition their calls.
> 
> Once migration is complete, WQ_UNBOUND can be removed and unbound will
> become the implicit default.
> 
> 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.
> 
> All existing users have been updated accordingly.
> 
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>

A similar per subsystem patch cut should be done here.

> ---
>  block/bio-integrity-auto.c                    |  5 +++--
>  block/bio.c                                   |  3 ++-
>  block/blk-core.c                              |  3 ++-
>  block/blk-throttle.c                          |  3 ++-
>  block/blk-zoned.c                             |  3 ++-

One for block.

>  crypto/cryptd.c                               |  3 ++-

One for crypto API.

>  drivers/acpi/ec.c                             |  3 ++-
>  drivers/acpi/osl.c                            |  4 ++--
>  drivers/acpi/thermal.c                        |  3 ++-
>  drivers/ata/libata-sff.c                      |  3 ++-
>  drivers/base/core.c                           |  2 +-
>  drivers/block/aoe/aoemain.c                   |  2 +-
>  drivers/block/rbd.c                           |  2 +-
>  drivers/block/rnbd/rnbd-clt.c                 |  2 +-
>  drivers/block/sunvdc.c                        |  2 +-
>  drivers/block/virtio_blk.c                    |  2 +-
>  drivers/bus/mhi/ep/main.c                     |  2 +-
>  drivers/char/tpm/tpm-dev-common.c             |  3 ++-
>  drivers/char/xillybus/xillybus_core.c         |  2 +-
>  drivers/char/xillybus/xillyusb.c              |  4 ++--
>  drivers/cpufreq/tegra194-cpufreq.c            |  3 ++-
>  drivers/crypto/atmel-i2c.c                    |  2 +-
>  drivers/crypto/cavium/nitrox/nitrox_mbx.c     |  2 +-
>  drivers/crypto/intel/qat/qat_common/adf_aer.c |  4 ++--
>  drivers/crypto/intel/qat/qat_common/adf_isr.c |  3 ++-
>  .../crypto/intel/qat/qat_common/adf_sriov.c   |  3 ++-
>  .../crypto/intel/qat/qat_common/adf_vf_isr.c  |  3 ++-
>  drivers/firewire/core-transaction.c           |  3 ++-
>  drivers/firewire/ohci.c                       |  3 ++-
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c      |  3 ++-
>  drivers/gpu/drm/bridge/analogix/anx7625.c     |  3 ++-
>  .../drm/i915/display/intel_display_driver.c   |  3 ++-
>  drivers/gpu/drm/i915/i915_driver.c            |  3 ++-
>  .../gpu/drm/i915/selftests/i915_sw_fence.c    |  2 +-
>  .../gpu/drm/i915/selftests/mock_gem_device.c  |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_drm.c         |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_sched.c       |  3 ++-
>  drivers/gpu/drm/radeon/radeon_display.c       |  3 ++-
>  drivers/gpu/drm/xe/xe_device.c                |  4 ++--
>  drivers/gpu/drm/xe/xe_ggtt.c                  |  2 +-
>  drivers/gpu/drm/xe/xe_hw_engine_group.c       |  3 ++-
>  drivers/gpu/drm/xe/xe_sriov.c                 |  2 +-
>  drivers/greybus/operation.c                   |  2 +-
>  drivers/hid/hid-nintendo.c                    |  3 ++-
>  drivers/hv/mshv_eventfd.c                     |  2 +-
>  drivers/i3c/master.c                          |  2 +-
>  drivers/infiniband/core/cm.c                  |  2 +-
>  drivers/infiniband/core/device.c              |  4 ++--
>  drivers/infiniband/hw/hfi1/init.c             |  3 +--
>  drivers/infiniband/hw/hfi1/opfn.c             |  3 +--
>  drivers/infiniband/hw/mlx4/cm.c               |  2 +-
>  drivers/infiniband/sw/rdmavt/cq.c             |  3 ++-
>  drivers/infiniband/ulp/iser/iscsi_iser.c      |  2 +-
>  drivers/infiniband/ulp/isert/ib_isert.c       |  2 +-
>  drivers/infiniband/ulp/rtrs/rtrs-clt.c        |  2 +-
>  drivers/infiniband/ulp/rtrs/rtrs-srv.c        |  2 +-
>  drivers/input/mouse/psmouse-smbus.c           |  2 +-
>  drivers/isdn/capi/kcapi.c                     |  2 +-
>  drivers/md/bcache/btree.c                     |  3 ++-
>  drivers/md/bcache/super.c                     | 10 ++++++----
>  drivers/md/bcache/writeback.c                 |  2 +-
>  drivers/md/dm-bufio.c                         |  3 ++-
>  drivers/md/dm-cache-target.c                  |  3 ++-
>  drivers/md/dm-clone-target.c                  |  3 ++-
>  drivers/md/dm-crypt.c                         |  6 ++++--
>  drivers/md/dm-delay.c                         |  4 +++-
>  drivers/md/dm-integrity.c                     | 15 ++++++++++-----
>  drivers/md/dm-kcopyd.c                        |  3 ++-
>  drivers/md/dm-log-userspace-base.c            |  3 ++-
>  drivers/md/dm-mpath.c                         |  5 +++--
>  drivers/md/dm-raid1.c                         |  5 +++--
>  drivers/md/dm-snap-persistent.c               |  3 ++-
>  drivers/md/dm-stripe.c                        |  2 +-
>  drivers/md/dm-verity-target.c                 |  4 +++-
>  drivers/md/dm-writecache.c                    |  3 ++-
>  drivers/md/dm.c                               |  3 ++-
>  drivers/md/md.c                               |  4 ++--
>  drivers/media/pci/ddbridge/ddbridge-core.c    |  2 +-
>  .../platform/mediatek/mdp3/mtk-mdp3-core.c    |  6 ++++--
>  drivers/message/fusion/mptbase.c              |  7 +++++--
>  drivers/mmc/core/block.c                      |  3 ++-
>  drivers/mmc/host/omap.c                       |  2 +-
>  drivers/net/can/spi/hi311x.c                  |  3 ++-
>  drivers/net/can/spi/mcp251x.c                 |  3 ++-
>  .../net/ethernet/cavium/liquidio/lio_core.c   |  2 +-
>  .../net/ethernet/cavium/liquidio/lio_main.c   |  8 +++++---
>  .../ethernet/cavium/liquidio/lio_vf_main.c    |  3 ++-
>  .../cavium/liquidio/request_manager.c         |  2 +-
>  .../cavium/liquidio/response_manager.c        |  3 ++-
>  .../net/ethernet/freescale/dpaa2/dpaa2-eth.c  |  2 +-
>  .../hisilicon/hns3/hns3pf/hclge_main.c        |  3 ++-
>  drivers/net/ethernet/intel/fm10k/fm10k_main.c |  2 +-
>  drivers/net/ethernet/intel/i40e/i40e_main.c   |  2 +-
>  .../net/ethernet/marvell/octeontx2/af/cgx.c   |  2 +-
>  .../marvell/octeontx2/af/mcs_rvu_if.c         |  2 +-
>  .../ethernet/marvell/octeontx2/af/rvu_cgx.c   |  2 +-
>  .../ethernet/marvell/octeontx2/af/rvu_rep.c   |  2 +-
>  .../marvell/octeontx2/nic/cn10k_ipsec.c       |  3 ++-
>  .../ethernet/marvell/prestera/prestera_main.c |  2 +-
>  .../ethernet/marvell/prestera/prestera_pci.c  |  2 +-
>  drivers/net/ethernet/mellanox/mlxsw/core.c    |  4 ++--
>  drivers/net/ethernet/netronome/nfp/nfp_main.c |  2 +-
>  drivers/net/ethernet/qlogic/qed/qed_main.c    |  3 ++-
>  drivers/net/ethernet/wiznet/w5100.c           |  2 +-
>  drivers/net/fjes/fjes_main.c                  |  5 +++--
>  drivers/net/wireguard/device.c                |  6 ++++--
>  drivers/net/wireless/ath/ath6kl/usb.c         |  2 +-
>  .../net/wireless/marvell/libertas/if_sdio.c   |  3 ++-
>  .../net/wireless/marvell/libertas/if_spi.c    |  3 ++-
>  .../net/wireless/marvell/libertas_tf/main.c   |  2 +-
>  drivers/net/wireless/quantenna/qtnfmac/core.c |  3 ++-
>  drivers/net/wireless/realtek/rtlwifi/base.c   |  2 +-
>  drivers/net/wireless/realtek/rtw88/usb.c      |  3 ++-
>  drivers/net/wireless/silabs/wfx/main.c        |  2 +-
>  drivers/net/wireless/st/cw1200/bh.c           |  4 ++--
>  drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c    |  3 ++-
>  drivers/net/wwan/wwan_hwsim.c                 |  2 +-
>  drivers/nvme/host/tcp.c                       |  2 ++
>  drivers/nvme/target/core.c                    |  5 +++--
>  drivers/nvme/target/fc.c                      |  6 +++---
>  drivers/nvme/target/tcp.c                     |  2 +-
>  drivers/pci/endpoint/functions/pci-epf-mhi.c  |  2 +-
>  drivers/pci/endpoint/functions/pci-epf-ntb.c  |  5 +++--
>  drivers/pci/endpoint/functions/pci-epf-test.c |  3 ++-
>  drivers/pci/endpoint/functions/pci-epf-vntb.c |  5 +++--
>  drivers/pci/hotplug/pnv_php.c                 |  3 ++-
>  drivers/pci/hotplug/shpchp_core.c             |  3 ++-
>  .../platform/surface/surface_acpi_notify.c    |  2 +-
>  drivers/power/supply/ab8500_btemp.c           |  3 ++-
>  drivers/power/supply/ipaq_micro_battery.c     |  3 ++-
>  drivers/rapidio/rio.c                         |  2 +-
>  drivers/s390/char/tape_3590.c                 |  2 +-
>  drivers/scsi/be2iscsi/be_main.c               |  3 ++-
>  drivers/scsi/bnx2fc/bnx2fc_fcoe.c             |  2 +-
>  drivers/scsi/device_handler/scsi_dh_alua.c    |  2 +-
>  drivers/scsi/fcoe/fcoe.c                      |  2 +-
>  drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c      |  3 ++-
>  drivers/scsi/lpfc/lpfc_init.c                 |  2 +-
>  drivers/scsi/pm8001/pm8001_init.c             |  2 +-
>  drivers/scsi/qedf/qedf_main.c                 | 15 ++++++++++-----
>  drivers/scsi/qedi/qedi_main.c                 |  2 +-
>  drivers/scsi/qla2xxx/qla_os.c                 |  2 +-
>  drivers/scsi/qla2xxx/qla_target.c             |  2 +-
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c            |  2 +-
>  drivers/scsi/qla4xxx/ql4_os.c                 |  3 ++-
>  drivers/scsi/scsi_transport_fc.c              |  7 ++++---
>  drivers/soc/fsl/qbman/qman.c                  |  2 +-
>  drivers/staging/greybus/sdio.c                |  2 +-
>  drivers/target/target_core_transport.c        |  4 ++--
>  drivers/target/target_core_xcopy.c            |  2 +-
>  drivers/target/tcm_fc/tfc_conf.c              |  2 +-
>  drivers/usb/core/hub.c                        |  2 +-
>  drivers/usb/gadget/function/f_hid.c           |  3 +--
>  drivers/usb/storage/uas.c                     |  2 +-
>  drivers/usb/typec/anx7411.c                   |  3 +--
>  drivers/vdpa/vdpa_user/vduse_dev.c            |  3 ++-
>  drivers/virt/acrn/irqfd.c                     |  3 ++-
>  drivers/virtio/virtio_balloon.c               |  3 ++-
>  drivers/xen/privcmd.c                         |  3 ++-

One for drivers.

>  include/linux/workqueue.h                     |  4 ++--

One for workqueue.

>  kernel/bpf/cgroup.c                           |  3 ++-

One for BPF.

>  kernel/cgroup/cgroup-v1.c                     |  2 +-
>  kernel/cgroup/cgroup.c                        |  2 +-

One for cgroup.

>  kernel/padata.c                               |  5 +++--

One for padata.

>  kernel/power/main.c                           |  2 +-

One for power.

>  kernel/rcu/tree.c                             |  4 ++--

One for RCU.

>  kernel/workqueue.c                            | 19 ++++++++++---------

Join the workqueue change above.

>  virt/kvm/eventfd.c                            |  2 +-

And one for KVM.

Thanks.

-- 
Frederic Weisbecker
SUSE Labs

  reply	other threads:[~2025-08-25 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 13:29 [PATCH v2 0/4] Workqueue: replace system wq and change alloc_workqueue callers Marco Crivellari
2025-08-25 13:29 ` [PATCH v2 1/4] Workqueue: replace use of system_wq with system_percpu_wq Marco Crivellari
2025-08-25 13:55   ` Frederic Weisbecker
2025-08-25 13:29 ` [PATCH v2 2/4] Workqueue: replace use of system_unbound_wq with system_dfl_wq Marco Crivellari
2025-08-25 13:49   ` Frederic Weisbecker
2025-08-25 13:29 ` [PATCH v2 3/4] Workqueue: WQ_PERCPU added to all the remaining users Marco Crivellari
2025-08-25 13:55   ` Frederic Weisbecker [this message]
2025-08-25 13:29 ` [PATCH v2 4/4] [Doc] Workqueue: WQ_UNBOUND doc upgraded Marco Crivellari
2025-08-25 13:57   ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKxrNPfjjACwqSAa@localhost.localdomain \
    --to=frederic@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco.crivellari@suse.com \
    --cc=mhocko@suse.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox