The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Marco Crivellari <marco.crivellari@suse.com>
To: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Marco Crivellari <marco.crivellari@suse.com>,
	Michal Hocko <mhocko@suse.com>
Subject: [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag
Date: Tue,  5 May 2026 18:16:56 +0200	[thread overview]
Message-ID: <20260505161658.401998-1-marco.crivellari@suse.com> (raw)

Hi,

The following is part of the Workqueue refactoring, and a first RFC about
the rename of the schedule_*() interfaces along with the introduction of
the "wq prefer per-cpu" workqueue and workqueue flag.

Any feedback is more then welcome!

~~~

More information about the reasons behind the workqueue refactoring can
be found at:

  https://lore.kernel.org/all/20250221112003.1dSuoGyc@linutronix.de/

Actually schedule_work() and schedule_work_on() enqueue works using
system_percpu_wq. The function name doesn't suggest it, on top of that,
only the per-cpu version is present.

Because of that, the following changes are introduced:

- queue_{bound|unbound}_work() as future replacement of schedule_work()

- queue_bound_work_on() as future replacement of schedule_work_on()

- queue_bound_delayed_work() as future replacement of
  schedule_delayed_work()

- queue_unbound_delayed_work() to offer the unbound version

- queue_bound_delayed_work_on() as future replacement of
  schedule_delayed_work_on()

The addition of queue_unbound_delayed_work() is because "delayed" functions
make use of a global timer and that means the work will be executed on the
CPU where the timer fired.

The Workqueue API currently do not distinguish between use case where
locality is important for correctness and where is important for
efficiency. So introduce WQ_PREFER_PERCPU and wq_prefer_percpu_wq, so
that works who need to be per-cpu but don't strictly require it, can
use such workqueue / workqueue flag.


Thanks!

Marco Crivellari (2):
  workqueue: Add queue_*() functions, future schedule_*() replacement
  workqueue: Add WQ_PREFER_PERCPU and system_prefer_percpu_wq

 include/linux/workqueue.h | 108 ++++++++++++++++++++++++++++++++++++++
 kernel/workqueue.c        |   6 ++-
 2 files changed, 113 insertions(+), 1 deletion(-)

-- 
2.53.0


             reply	other threads:[~2026-05-05 16:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 16:16 Marco Crivellari [this message]
2026-05-05 16:16 ` [RFC PATCH 1/2] workqueue: Add queue_*() functions, future schedule_*() replacement Marco Crivellari
2026-05-05 16:16 ` [RFC PATCH 2/2] workqueue: Add WQ_PREFER_PERCPU and system_prefer_percpu_wq Marco Crivellari
2026-05-05 20:18 ` [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag Tejun Heo
2026-05-06 13:40   ` Breno Leitao
2026-05-07 10:25     ` Marco Crivellari
2026-05-07 21:27       ` Tejun Heo
2026-05-08 12:09         ` Frederic Weisbecker
2026-05-08 15:11           ` Tejun Heo

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=20260505161658.401998-1-marco.crivellari@suse.com \
    --to=marco.crivellari@suse.com \
    --cc=bigeasy@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --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