Re: [PATCH 0/4] rust: Add support for reserving of ranges of IDs
"Eliot Courtney" <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Mon Jul 6, 2026 at 8:48 PM JST, Alice Ryhl wrote: > On Fri, Jul 03, 2026 at 07:16:03PM +0900, Eliot Courtney wrote: >> Add support for reserving of ranges of IDs, with a usage in nova-core >> for channel IDs. This entails adding the helpers+users of the C bitmap >> API for ranges of bits, then users of that in `IdPool`, and finally a >> user of `IdPool` in nova-core, `ChannelIdPool`. > > If you need ranges of IDs, perhaps you want the maple tree instead? > > Alice I think maple tree would work, but it looked like not as good a fit to me because: - the number of channel IDs is small (limited to 2048) - allocation of a contiguous sequence of channel IDs is sometimes aligned to its size (which should be a power of two, AFAICT) - I realise patch 4 doesn't reflect this (yet). The bitmap APIs natively support this. - maple tree's alloc_range stores a value: T for the range which isn't necessary for ID alloc WDYT?