lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v12 01/16] perf record: Introduce thread affinity and mmap masks
From
On 05.12.2021 18:13, Jiri Olsa wrote:
> On Tue, Nov 23, 2021 at 05:07:57PM +0300, Alexey Bayduraev wrote:
>
> SNIP
>
>> +static void record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_cpu_map *cpus)
>> +{
>> + int c;
>> +
>> + for (c = 0; c < cpus->nr; c++)
>> + set_bit(cpus->map[c], mask->bits);
>> +}
>> +
>> +static void record__free_thread_masks(struct record *rec, int nr_threads)
>> +{
>> + int t;
>> +
>> + if (rec->thread_masks)
>> + for (t = 0; t < nr_threads; t++)
>> + record__thread_mask_free(&rec->thread_masks[t]);
>> +
>> + zfree(&rec->thread_masks);
>> +}
>> +
>> +static int record__alloc_thread_masks(struct record *rec, int nr_threads, int nr_bits)
>> +{
>> + int t, ret;
>> +
>> + rec->thread_masks = zalloc(nr_threads * sizeof(*(rec->thread_masks)));
>> + if (!rec->thread_masks) {
>> + pr_err("Failed to allocate thread masks\n");
>> + return -ENOMEM;
>> + }
>> +
>> + for (t = 0; t < nr_threads; t++) {
>> + ret = record__thread_mask_alloc(&rec->thread_masks[t], nr_bits);
>> + if (ret)
>> + goto out_free;
>> + record__thread_mask_clear(&rec->thread_masks[t]);
>
> nit, is this clear needed?

Hi,

You are right, since all elements of mask->bits is set to zero after
bitmap_zalloc in record__thread_mask_alloc, calling
record__thread_mask_clear after record__thread_mask_alloc
is redundant.
I will remove it here and in [PATCH v12 13/16].

Thanks,
Alexey

>
> jirka
>
>> + }
>> +
>> + return 0;
>> +
>> +out_free:
>> + record__free_thread_masks(rec, nr_threads);
>> +
>> + return ret;
>> +}
>> +
>
> SNIP
>

\
 
 \ /
  Last update: 2021-12-20 11:39    [W:0.072 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site