Re: Re: [PATCH 1/2] rnull: support 64K pages
From: Vitaly Wool
Date: Wed Dec 02 2026 - 13:07:41 EST
<snip>
> > A `BitmapVec` keeps up to `usize::BITS` bits inline and allocates its
> > storage with `bitmap_zalloc()` beyond that. A bitmap embedded in a
> > structure that is allocated anyway, with a maximum length known at
> > compile time, then needs a second allocation and a pointer to follow,
> > or `unsafe` code that wraps an array with `Bitmap::from_raw()`.
> >
> > Add `BitmapArray<WORDS>`, an owned bitmap of up to `WORDS` words of
> > bits stored inline, which never allocates and dereferences to `Bitmap`
> > like `BitmapVec`.
> BitmapArray is a tautology. Bitmap is already an "array of bits". So
> unless you're talking about 2d bitmaps, the name is wrong
Well, this is a theological thing in some sense. One may argue that a
bitmap is a _vector_ of bits, so BitmapVec is also a tautology. I would
prefer we didn't go into that rabbit hole.
> > +/// ```
> > +/// use kernel::bitmap::BitmapArray;
> > +///
> > +/// let mut b = BitmapArray::<2>::new(100)?;
> >
> This is simply wrong. On my 32-bit box this wouldn't work, for sure.
> Check how DECLARE_BITMAP() works in C. It doesn't take the number of
> words. The same holds for every other bitmap function. That's on
> purpose, because one of the main goals of the API is to decouple the
> data structure from machine specifics.
This is a good point indeed, we'll rework this patch to be rid of
machine specifics. With that said, this patch came as a preparation for
the fix to rnull, and as far as I know, rnull doesn't even build for
32-bit ARM.
(We may want to fix that, right @Andreas?)
Med vänliga hälsningar/Best regards,
Vitaly