Re: [PATCH v1 2/3] perf mmap: declare type for cpu mask of arbitrary length

From: Alexey Budankov
Date: Fri Nov 22 2019 - 11:01:47 EST


On 22.11.2019 16:58, Alexey Budankov wrote:
> On 22.11.2019 16:20, Jiri Olsa wrote:
>> On Wed, Nov 20, 2019 at 12:37:48PM +0300, Alexey Budankov wrote:
>>>

<SNIP>

>>> +#define mmap_cpu_mask_bytes(m) \
>>
>> we try to have all macros upper case
>
> In v2.
>
>>
>>> + (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long))
>>
>> we have BITS_TO_BYTES
>
> In v2.

Avoided BITS_TO_BYTES() in this particular case because
the storage is allocated in unsigned long chunks, thus
the possibly unused tail bytes at the last chunk would
be accounted in the returned size, and for compatibility
with cpu_set_t which is also allocated in unsigned longs.

~Alexey