Re: [PATCH v6 4/6] rust: xarray: Add support for index reservations

Philipp Stanner <[email protected]>
Newsgroups org.kernel.vger.rcu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Wed, 2026-08-05 at 10:50 +0200, Andreas Hindborg wrote:
> "Philipp Stanner" <[email protected]> writes:
> 
> > One often cannot allocate in the kernel with the desired flags, most
> > notably in atomic context. Pre-allocating the memory is the preferred
> > solution in such situations.
> > 
> > Add support for xa_reserve() in the Rust abstractions of xarray. Create
> > a Reservation object similar to a lock-guard, that can be dropped once
> > the reservation is no longer needed or once the index was stored to.
> > 
> > Signed-off-by: Philipp Stanner <[email protected]>
> > ---
> > Please regard this more as an RFC.
> > 
> > I need pre-allocating in XArray for DmaFence. How exactly we achieve
> > this is open for discussion.
> 
> Do you need to actually reserve a key, or do you just need atomic
> allocation?

I would just have needed a position to store to, but the fence sequence
number would be the only reasonable index, so you'd also reserve a key.



Anyways, please forget about this for now, we abstained from using the
XArray in the current revision (v8) of this patch series.


Thx
P.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.