[PATCH v6 1/5] lib/bitmap: add bitmap_{read,write}()

Rasmus Villemoes linux at rasmusvillemoes.dk
Tue Oct 10 04:03:21 PDT 2023


On 10/10/2023 11.17, Alexander Potapenko wrote:

>> 'behaves similarly' sounds like an understatement. I think, it behaves
>> much faster because it can assign up to 64 bits at once, not mentioning
>> the pressure on cache lines traffic.
> 
> My intent was to describe the visible behavior, of course the
> generated code is better, and the number of memory accesses lower.
> 
> How about the following description:
> 
>  * The result of bitmap_write() is similar to @nbits calls of assign_bit(), i.e.
>  * bits beyond @nbits are ignored:
>  *
>  *   for (bit = 0; bit < nbits; bit++)
>  *           assign_bit(start + bit, bitmap, val & BIT(bit));
> 
> ?

C programmers should know the meaning of the term "as-if". Perhaps use
that. Smth like "bitmap_write() behaves as-if implemented as @nbits
calls of __assign_bit()".

Rasmus




More information about the linux-arm-kernel mailing list