Re: [PATCH] workqueue: rust: add delayed work items
From: Tejun Heo
Date: Tue Apr 15 2025 - 13:04:32 EST
On Tue, Apr 15, 2025 at 09:21:48AM +0000, Alice Ryhl wrote:
> On Mon, Apr 14, 2025 at 07:47:19AM -1000, Tejun Heo wrote:
> > On Fri, Apr 11, 2025 at 11:12:29AM +0000, Alice Ryhl 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.
> > >
> > > Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> >
> > FWIW, looks fine to me on the first glance. Please let me know how you want
> > to route it. If you want it to be through the wq tree, please let me know
> > what to do about the dependencies (I just applied the "remove
> > HasWork::OFFSET" patch to wq/for-6.16 but don't have the other one).
>
> Normally I think it is most natural for workqueue patches to go through
> your tree, but it may be easier to take it through Miguel's tree with
> your ack as an exception this merge window since the container_of change
> will probably also affect other work.
>
> It sounds like this is also the conclusion you and Miguel came to in the
> thread on the HasWork::OFFSET patch.
>
> (If you're planning to change the default workqueue configuration from
> PERCPU to UNBOUNDED this merge window, then please let me know because
> it might change the calculus here.)
The rename is going to be a while, I think. Please route this through the
rust tree.
Acked-by: Tejun Heo <tj@xxxxxxxxxx>
Thanks.
--
tejun