[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <90352f48-86a8-f8d9-2b74-b884b32d013d@linux.intel.com>
Date: Mon, 20 Dec 2021 13:37:48 +0300
From: "Bayduraev, Alexey V" <alexey.v.bayduraev@...ux.intel.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Antonov <alexander.antonov@...ux.intel.com>,
Alexei Budankov <abudankov@...wei.com>,
Riccardo Mancini <rickyman7@...il.com>
Subject: Re: [PATCH v12 01/16] perf record: Introduce thread affinity and mmap
masks
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
>
Powered by blists - more mailing lists