[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d48d2634-408c-9ba9-2d2f-5c9629656c2e@asahilina.net>
Date: Fri, 24 Feb 2023 21:32:15 +0900
From: Asahi Lina <lina@...hilina.net>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Matthew Wilcox <willy@...radead.org>
Cc: Martin Rodriguez Reboredo <yakoyoku@...il.com>,
Neal Gompa <neal@...pa.dev>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, asahi@...ts.linux.dev
Subject: Re: [PATCH] rust: xarray: Add an abstraction for XArray
On 24/02/2023 20.44, Asahi Lina wrote:
> The XArray is an abstract data type which behaves like a very large
> array of pointers. Add a Rust abstraction for this data type.
>
> The initial implementation uses explicit locking on get operations and
> returns a guard which blocks mutation, ensuring that the referenced
> object remains alive. To avoid excessive serialization, users are
> expected to use an inner type that can be efficiently cloned (such as
> Arc<T>), and eagerly clone and drop the guard to unblock other users
> after a lookup.
>
> Future variants may support using RCU instead to avoid mutex locking.
>
> This abstraction also introduces a reservation mechanism, which can be
> used by alloc-capable XArrays to reserve a free slot without immediately
> filling it, and then do so at a later time. If the reservation is
> dropped without being filled, the slot is freed again for other users,
> which eliminates the need for explicit cleanup code.
>
> Signed-off-by: Asahi Lina <lina@...hilina.net>
> ---
I forgot to mention this depends on the Error series [1]. Sorry about that!
[1]
https://lore.kernel.org/rust-for-linux/20230224-rust-error-v1-0-f8f9a9a87303@asahilina.net/T/#t
~~ Lina
Powered by blists - more mailing lists