Re: [PATCH 2/4] rust: bitmap: add contiguous area operations
From: Alice Ryhl
Date: Thu Jul 09 2026 - 05:01:38 EST
On Mon, Jul 06, 2026 at 07:22:27PM +0100, Gary Guo wrote:
> On Mon Jul 6, 2026 at 6:21 PM BST, Alice Ryhl wrote:
> > On Mon, Jul 06, 2026 at 12:29:00PM -0400, Yury Norov wrote:
> >> All three are the wrappers around the regular outline functions:
> >> bitmap_find_next_zero_area_off(), __bitmap_set() and __bitmap_clear().
> >>
> >> The inlined version in headers is optimized for small bitmaps. But the
> >> optimization is all based on inlining in the C code. It doesn't work
> >> if you wrap it with a rust helper.
> >>
> >> There was a discussion about the similar find_next_bit(). The function
> >> itself is an inliner, but it's a wrapper around the true outlined
> >> _find_next_bit(). So we decided to minimize the binder size for that
> >> type of functions.
> >>
> >> Please, keep the binder minimal unless necessary.
> >
> > If we can just call __bitmap_clear() without any downsides, then I agree
> > we should do that, but we actually do support inlining the helpers now.
> > See CONFIG_RUST_INLINE_HELPERS.
>
> bitmap uses __builtin_constant_p which will only work with pure C inlining and
> not LLVM IR based inlining.
Ack in that case using __bitmap_clear() from Rust definitely makes sense. Thanks
Alice