[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72mwz1_CV9Gckcdg-WRa1ufOrKNU1Z8V9rM6POcwesD4KA@mail.gmail.com>
Date: Thu, 17 Jul 2025 00:49:48 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Tejun Heo <tj@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Daniel Almeida <daniel.almeida@...labora.com>,
Tamir Duberstein <tamird@...il.com>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, Benno Lossin <lossin@...nel.org>
Subject: Re: [PATCH v3] workqueue: rust: add delayed work items
On Fri, Jul 11, 2025 at 9:59 AM Alice Ryhl <aliceryhl@...gle.com> wrote:
>
> This patch is being sent for use in the various Rust GPU drivers that
> are under development. It provides the additional feature of work items
> that are executed after a delay.
>
> The design of the existing workqueue is rather extensible, as most of
> the logic is reused for delayed work items even though a different work
> item type is required. The new logic consists of:
>
> * A new DelayedWork struct that wraps struct delayed_work.
> * A new impl_has_delayed_work! macro that provides adjusted versions of
> the container_of logic, that is suitable with delayed work items.
> * A `enqueue_delayed` method that can enqueue a delayed work item.
>
> This patch does *not* rely on the fact that `struct delayed_work`
> contains `struct work_struct` at offset zero. It will continue to work
> even if the layout is changed to hold the `work` field at a different
> offset.
>
> Please see the example introduced at the top of the file for example
> usage of delayed work items.
>
> Acked-by: Tejun Heo <tj@...nel.org>
> Reviewed-by: Boqun Feng <boqun.feng@...il.com>
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
Applied (yesterday) to `rust-next` -- thanks everyone!
[ Replaced `as _` with `as ffi::c_int` to clean warning. - Miguel ]
Cheers,
Miguel
Powered by blists - more mailing lists