mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Lai Jiangshan" <jiangshanlai@gmail.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Philipp Stanner" <phasta@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	driver-core@lists.linux.dev
Subject: Re: [PATCH v4 5/5] rust: workqueue: add ScopedWork for non-'static work items
Date: Thu, 26 Nov 2026 02:22:54 -1000	[thread overview]
Message-ID: <f9d8ff6a6c4a4d098e0d461da4e40474@kernel.org> (raw)
In-Reply-To: <20261125181752.2027207-1-aliceryhl@google.com>

Hello, Alice.

On Wed, Nov 25, 2026 at 06:17:52PM +0000, Alice Ryhl wrote:
> What I'd say is that this isn't the only way to spawn work on the
> workqueue. This utility is intended for use-cases where it's convenient
> to do it like that (e.g. because the queue is defined before the work
> item in the same struct). We already have another way of spawning work
> that uses different ownership rules (e.g. self-freeing work) and that
> mechanism would not go through ScopedWork.

This is your design and you know this area far better than I do, so please
take this with a grain of salt. That said, I wonder whether the interface
is more tortured and twisted than it needs to be.

Workqueue lifetime seems to add a layer of ugliness, at least going by the
restrictions on ScopedWork. Wouldn't that be relatively easy to solve by
adding a percpu refcnt to the Rust wrapper of workqueue and tying work and
delayed work items to it? Dropping the workqueue would wait until nothing
is pending, and cancelling delayed work items before that would be up to
the user. Work and delayed work items would then behave the same way and
be usable on any workqueue.

Thanks.

--
tejun

  reply	other threads:[~2026-11-26 12:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 14:12 [PATCH v4 0/5] workqueue: OwnedQueue and ScopedWork Alice Ryhl
2026-11-19 14:12 ` [PATCH v4 1/5] rust: workqueue: support stack-allocated work items Alice Ryhl
2026-11-19 14:37   ` Gary Guo
2026-11-19 15:17     ` Alice Ryhl
2026-11-25 16:56       ` Gary Guo
2026-11-19 14:12 ` [PATCH v4 2/5] rust: workqueue: restrict delayed work to global wqs Alice Ryhl
2026-11-19 14:12 ` [PATCH v4 3/5] rust: workqueue: create workqueue subdirectory Alice Ryhl
2026-11-19 14:37   ` Gary Guo
2026-11-19 14:12 ` [PATCH v4 4/5] rust: workqueue: add creation of workqueues Alice Ryhl
2026-11-25 16:57   ` Gary Guo
2026-11-26  7:56   ` kernel test robot
2026-11-19 14:12 ` [PATCH v4 5/5] rust: workqueue: add ScopedWork for non-'static work items Alice Ryhl
2026-11-25 16:44   ` Tejun Heo
2026-11-25 17:09     ` Gary Guo
2026-11-25 18:17     ` Alice Ryhl
2026-11-26 12:22       ` Tejun Heo [this message]
2026-11-26 12:43         ` Alice Ryhl
2026-11-25 17:09   ` Gary Guo

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=f9d8ff6a6c4a4d098e0d461da4e40474@kernel.org \
    --to=tj@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=phasta@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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

all inboxes | Powered by JetHome®