Re: [PATCH v4 3/4] perf record: apply affinity masks when reading mmap buffers

From: Alexey Budankov
Date: Tue Jan 22 2019 - 07:55:41 EST


Hi,
On 21.01.2019 14:54, Jiri Olsa wrote:
> On Wed, Jan 16, 2019 at 12:23:05PM +0300, Alexey Budankov wrote:
>
> SNIP
>
>> static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist,
>> bool overwrite)
>> {
>> @@ -755,6 +768,7 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
>> struct perf_mmap *map = &maps[i];
>>
>> if (map->base) {
>> + record__adjust_affinity(rec, map);
>> if (!record__aio_enabled(rec)) {
>> if (perf_mmap__push(map, rec, record__pushfn) != 0) {
>> rc = -1;
>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>> index 08cedb643ea6..178d3280ba62 100644
>> --- a/tools/perf/util/evlist.c
>> +++ b/tools/perf/util/evlist.c
>> @@ -1032,7 +1032,11 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
>> * Its value is decided by evsel's write_backward.
>> * So &mp should not be passed through const pointer.
>> */
>> - struct mmap_params mp = { .nr_cblocks = nr_cblocks, .affinity = affinity };
>> + struct mmap_params mp = {
>> + .nr_cblocks = nr_cblocks,
>> + .affinity = affinity,
>> + .cpu_map = cpu_map__new(NULL) /* from /sys/devices/system/cpu/online */
>> + };
>
> cpu_map won't get released.. if there's no better solution,
> at least we could have it as static in build_node_mask..
> this way it will be created only once

nice catch, thanks!! moved the static into a separate cpu_map__online()
in cpumap.c and that simplified the changes a bit.

Alexey

>
> jirka
>