[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aF2nwx6fRlhzbdsq@tardis.local>
Date: Thu, 26 Jun 2025 13:04:19 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, ojeda@...nel.org,
alex.gaynor@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
lossin@...nel.org, a.hindborg@...nel.org, aliceryhl@...gle.com,
tmgross@...ch.edu, david.m.ertman@...el.com, ira.weiny@...el.com,
leon@...nel.org, kwilczynski@...nel.org, bhelgaas@...gle.com,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org
Subject: Re: [PATCH v3 3/4] rust: devres: get rid of Devres' inner Arc
On Thu, Jun 26, 2025 at 09:47:18PM +0200, Danilo Krummrich wrote:
> On Wed, Jun 25, 2025 at 09:13:24PM -0700, Boqun Feng wrote:
> > On Tue, Jun 24, 2025 at 11:54:01PM +0200, Danilo Krummrich wrote:
> > `T` also need to be `Send` for `Devres<T>` to be `Sync` because that's
> > what `Revocable<T>` requires.
>
> I think that's because of Revocable::revoke(), however you can't call
> Devres::revoke().
Well, what could happen is we create a `Arc<Devres<T>>` on one thread,
and because it's `Sync`, we can have a clone of it in another thread,
and if that's the last one call `Arc::drop()`, the `Revocable` will be
`revoke()`d in a different thread than it's created.
But with `T` always being `Send`, this is not a problem now.
Regards,
Boqun
>
> > (Unless we want `T` always being `Send`
> > because of the issue I mentioned above)
>
> Yes, we do.
>
> > The rest looks good to me.
>
> Great! :)
Powered by blists - more mailing lists