Re: [PATCH 2/2] bitmap: introduce for_each_set_bitrange

From: Yury Norov
Date: Fri Jul 09 2021 - 02:21:22 EST


On Thu, Jul 08, 2021 at 08:45:19PM -0700, Yury Norov wrote:
> bitmap_list_string() is very ineffective when printing bitmaps with long
> ranges of set bits because it calls find_next_bit for each bit. We can do
> better by detecting ranges of set bits.
>
> This patch introduces a macro for_each_set_bitrange and uses it in
> bitmap_list_string(). In my environment, before/after is 943008/31008 ns.

Ah, it seems we already have bitmap_for_each_{set,clear}_region() with
the same functionality. I'll check everything again and submit v2 soon.