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

Andreas Hindborg <[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]>
"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 have a series that solves the allocation issue here [1]. Tamir did a
reservation API a while back [2].

Best regards,
Andreas Hindborg

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
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.