On 20.03.2025 01:57, Stefano Stabellini wrote:
> On Wed, 19 Mar 2025, Jan Beulich wrote:
>> What about xenctl_bitmap_to_bitmap()?
>  
> Let me see first if I managed to handle bitmap_to_xenctl_bitmap well.

Well, the code looks correct to me, but the description now has gone
stale. I also wonder whether with that extra restriction the optimization
is then actually worth it. Just one further nit:

> --- a/xen/common/bitmap.c
> +++ b/xen/common/bitmap.c
> @@ -384,21 +384,33 @@ int bitmap_to_xenctl_bitmap(struct xenctl_bitmap 
> *xenctl_bitmap,
>      uint8_t zero = 0;
>      int err = 0;
>      unsigned int xen_bytes = DIV_ROUND_UP(nbits, BITS_PER_BYTE);
> -    uint8_t *bytemap = xmalloc_array(uint8_t, xen_bytes);
> -
> -    if ( !bytemap )
> -        return -ENOMEM;
> +    bool alloc = (bitmap[nbits/8] & ((1U << (nbits % 8)) - 1)) ||

Blanks missing around / here.

Jan

Reply via email to