From: Alice Ryhl <aliceryhl@google.com>
To: Gary Guo <gary@garyguo.net>
Cc: "Alice Ryhl" <aliceryhl@google.com>, "Tejun Heo" <tj@kernel.org>,
"Lai Jiangshan" <jiangshanlai@gmail.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"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 1/5] rust: workqueue: support stack-allocated work items
Date: Thu, 19 Nov 2026 15:17:17 +0000 [thread overview]
Message-ID: <20261119151717.682282-1-aliceryhl@google.com> (raw)
In-Reply-To: <DMZ9I1E2XDQ7.3F0NFO0VNO0BU@garyguo.net>
On Thu, Nov 19, 2026 at 02:37:17PM +0000, Gary Guo wrote:
> On Thu Nov 19, 2026 at 2:12 PM GMT, Alice Ryhl wrote:
> > __rust_helper void rust_helper_init_work_with_key(struct work_struct *work,
> > work_func_t func,
> > - bool onstack,
> > const char *name,
> > struct lock_class_key *key)
> > {
> > - __init_work(work, onstack);
> > + __init_work(work, object_is_on_stack(work));
>
> Is this fully optimized out if !CONFIG_DEBUG_OBJECTS_WORK?
Yes, on normal architectures (checked x86_64 and arm64 with Clang and
GCC): `get_current()` omits `volatile` and `current->stack` is a plain
load, so DCE removes all of `object_is_on_stack(work)` once the empty
`__init_work()` stub is inlined.
The one exception is `ARCH=um` with `CONFIG_SMP=y`, where `get_current()`
calls an external `uml_curr_cpu()` function without `__attribute_const__`
(and under `CONFIG_RUST_INLINE_HELPERS`, the dead `mrs`/`movq %gs:...`
inline asm stays in `helpers.bc` until backend codegen drops it). I can
wrap it in `if (IS_ENABLED(CONFIG_DEBUG_OBJECTS_WORK))` if I send a v5.
Alice
next prev parent reply other threads:[~2026-11-19 15:17 UTC|newest]
Thread overview: 9+ 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 [this message]
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-19 14:12 ` [PATCH v4 5/5] rust: workqueue: add ScopedWork for non-'static work items Alice Ryhl
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=20261119151717.682282-1-aliceryhl@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.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=tj@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®