Re: [PATCH 3/4] rust: id_pool: add contiguous area allocation
From: Eliot Courtney
Date: Tue Jul 07 2026 - 09:36:16 EST
On Fri Jul 3, 2026 at 7:31 PM JST, Greg KH wrote:
> On Fri, Jul 03, 2026 at 07:16:06PM +0900, Eliot Courtney wrote:
>> Add support for contiguous area allocation. Add a new type,
>> `UnusedArea`, following the same pattern as `UnusedId`.
>>
>> Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
>
> Why isn't the built-in idr library being used here instead of rolling
> your own data structure?
>
> thanks,
>
> greg k-h
For nova-core in this series, we need allocation of a contiguous
sequence of IDs with a specific length and sometimes a specific
alignment. IIUC, IDA/xarray do not support that (I checked
ida_alloc_range and it only allocates a single ID in a range, not a
contiguous sequence).
For IdPool before this series, I think it could have used IDA/xarray.
See [1] where Alice has posted some more context.
w.r.t. the structure choice, the IDs we need to allocate are channel
IDs, and the total range is limited to 2048 of them, so IMO bitmaps are
a better fit than e.g. maple tree.
Thanks!
[1] https://lore.kernel.org/all/akujuAJOZxRJlQZo@xxxxxxxxxx/