Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf cpumap: Use perf_cpu_map__cpu(map, cpu) instead of accessing map->map[cpu] directly

So that we can validate the 'map' instance wrt refcount checking.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Link: https://lore.kernel.org/lkml/20230407230405.2931830-3-irogers@google.com
[ Extracted from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
491b13c4 d57fd492

+5 -5
+5 -5
tools/perf/util/cpumap.c
··· 582 582 bool last = i == perf_cpu_map__nr(map); 583 583 584 584 if (!last) 585 - cpu = map->map[i]; 585 + cpu = perf_cpu_map__cpu(map, i); 586 586 587 587 if (start == -1) { 588 588 start = i; 589 589 if (last) { 590 590 ret += snprintf(buf + ret, size - ret, 591 591 "%s%d", COMMA, 592 - map->map[i].cpu); 592 + perf_cpu_map__cpu(map, i).cpu); 593 593 } 594 - } else if (((i - start) != (cpu.cpu - map->map[start].cpu)) || last) { 594 + } else if (((i - start) != (cpu.cpu - perf_cpu_map__cpu(map, start).cpu)) || last) { 595 595 int end = i - 1; 596 596 597 597 if (start == end) { 598 598 ret += snprintf(buf + ret, size - ret, 599 599 "%s%d", COMMA, 600 - map->map[start].cpu); 600 + perf_cpu_map__cpu(map, start).cpu); 601 601 } else { 602 602 ret += snprintf(buf + ret, size - ret, 603 603 "%s%d-%d", COMMA, 604 - map->map[start].cpu, map->map[end].cpu); 604 + perf_cpu_map__cpu(map, start).cpu, perf_cpu_map__cpu(map, end).cpu); 605 605 } 606 606 first = false; 607 607 start = i;