Skip to content

Commit 84d2f4f

Browse files
captain5050acmel
authored andcommitted
perf c2c: Use more intention revealing iterator
Use perf_cpu_map__for_each_cpu() in setup_nodes. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: John Garry <john.garry@huawei.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Vineet Singh <vineet.singh@intel.com> Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: zhengjun.xing@intel.com Link: https://lore.kernel.org/r/20220105061351.120843-46-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 7263f34 commit 84d2f4f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tools/perf/builtin-c2c.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ static int setup_nodes(struct perf_session *session)
20152015
{
20162016
struct numa_node *n;
20172017
unsigned long **nodes;
2018-
int node, cpu;
2018+
int node, cpu, idx;
20192019
int *cpu2node;
20202020

20212021
if (c2c.node_info > 2)
@@ -2057,13 +2057,13 @@ static int setup_nodes(struct perf_session *session)
20572057
if (perf_cpu_map__empty(map))
20582058
continue;
20592059

2060-
for (cpu = 0; cpu < map->nr; cpu++) {
2061-
set_bit(map->map[cpu], set);
2060+
perf_cpu_map__for_each_cpu(cpu, idx, map) {
2061+
set_bit(cpu, set);
20622062

2063-
if (WARN_ONCE(cpu2node[map->map[cpu]] != -1, "node/cpu topology bug"))
2063+
if (WARN_ONCE(cpu2node[cpu] != -1, "node/cpu topology bug"))
20642064
return -EINVAL;
20652065

2066-
cpu2node[map->map[cpu]] = node;
2066+
cpu2node[cpu] = node;
20672067
}
20682068
}
20692069

0 commit comments

Comments
 (0)