On Wed, 2026-08-05 at 10:50 +0200, Andreas Hindborg wrote:
"Philipp Stanner" phasta@kernel.org 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 phasta@kernel.org
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.