Re: [PATCH v10 2/3] rust: id_pool: do not round capacity up to BitmapVec::MAX_INLINE_LEN

From: Burak Emir

Date: Sat Nov 07 2026 - 09:04:39 EST


On Sat, Nov 7, 2026 at 1:58 PM Alexandre Courbot <acourbot@xxxxxxxxxx> wrote:
>
> On Mon Oct 19, 2026 at 1:29 PM JST, Eliot Courtney wrote:
> > Current code in IdPool::with_capacity rounds the capacity up to
> > BitmapVec::MAX_INLINE_LEN, but BitmapVec::new works fine with values
> > smaller than this and still uses an inline representation. Remove this
> > behaviour.
> >
> > This allows specifying a real capacity of 0, which was not previously
> > possible. This breaks `grow_request` in this case, so change it to grow
> > to at least `BitmapVec::MAX_INLINE_LEN`, mirroring the capacity floor in
> > `shrink_request`.
> >
> > Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
> > ---
> > rust/kernel/id_pool.rs | 38 ++++++++++++++++++++++++++++++++------
> > 1 file changed, 32 insertions(+), 6 deletions(-)
>
> Alice, Burak, Yury: I would like to get this series out of its current
> limbo. AFAICT, Alice and Burak are ok with the current design [1][2],
> and Yury's request to change stop using a zero-sized pool in the example
> has been fulfilled by this patch [3].
>
> This series would need to go through drm-rust-next as we have
> dependencies on it for the 4.5 cycle. May I ask for an ack on this patch
> to push it through drm-rust-next?

Reviewed-by: Burak Emir <burak.emir@xxxxxxxxx>

For me, yes, it is good.

In particular, the thing that Sashiko finds the panic of using 0 size
with find_unused_id and CONFIG_RUST_BITMAP_HARDENED=y was explicitly
discussed before and is intended behavior.

cheers,
Burak