]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
perf c2c: Use more intention revealing iterator
authorIan Rogers <irogers@google.com>
Wed, 5 Jan 2022 06:13:48 +0000 (22:13 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 12 Jan 2022 17:28:23 +0000 (14:28 -0300)
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>
tools/perf/builtin-c2c.c

index b5c67ef73862b8d80c1fa8b2399f035f8bd1c04e..ad1fbeafc93d6219f696a95a9f4e96ad1a9a7a0e 100644 (file)
@@ -2015,7 +2015,7 @@ static int setup_nodes(struct perf_session *session)
 {
        struct numa_node *n;
        unsigned long **nodes;
-       int node, cpu;
+       int node, cpu, idx;
        int *cpu2node;
 
        if (c2c.node_info > 2)
@@ -2057,13 +2057,13 @@ static int setup_nodes(struct perf_session *session)
                if (perf_cpu_map__empty(map))
                        continue;
 
-               for (cpu = 0; cpu < map->nr; cpu++) {
-                       set_bit(map->map[cpu], set);
+               perf_cpu_map__for_each_cpu(cpu, idx, map) {
+                       set_bit(cpu, set);
 
-                       if (WARN_ONCE(cpu2node[map->map[cpu]] != -1, "node/cpu topology bug"))
+                       if (WARN_ONCE(cpu2node[cpu] != -1, "node/cpu topology bug"))
                                return -EINVAL;
 
-                       cpu2node[map->map[cpu]] = node;
+                       cpu2node[cpu] = node;
                }
        }