perf cpumap: Use for each loop
Improve readability in perf_pmu__cpus_match() by using perf_cpu_map__for_each_cpu(). Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: André Almeida <andrealmeid@collabora.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Eric Dumazet <edumazet@google.com> Cc: German Gomez <german.gomez@arm.com> Cc: Hao Luo <haoluo@google.com> Cc: James Clark <james.clark@arm.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> 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: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Miaoqian Lin <linmq006@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com> Cc: Song Liu <song@kernel.org> Cc: Stephane Eranian <eranian@google.com> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Yury Norov <yury.norov@gmail.com> Link: http://lore.kernel.org/lkml/20220211103415.2737789-3-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Родитель
c56c39276b
Коммит
6a12a63e5f
|
@ -1998,7 +1998,8 @@ int perf_pmu__cpus_match(struct perf_pmu *pmu, struct perf_cpu_map *cpus,
|
|||
{
|
||||
struct perf_cpu_map *pmu_cpus = pmu->cpus;
|
||||
struct perf_cpu_map *matched_cpus, *unmatched_cpus;
|
||||
int matched_nr = 0, unmatched_nr = 0;
|
||||
struct perf_cpu cpu;
|
||||
int i, matched_nr = 0, unmatched_nr = 0;
|
||||
|
||||
matched_cpus = perf_cpu_map__default_new();
|
||||
if (!matched_cpus)
|
||||
|
@ -2010,14 +2011,11 @@ int perf_pmu__cpus_match(struct perf_pmu *pmu, struct perf_cpu_map *cpus,
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cpus->nr; i++) {
|
||||
int cpu;
|
||||
|
||||
cpu = perf_cpu_map__idx(pmu_cpus, cpus->map[i]);
|
||||
if (cpu == -1)
|
||||
unmatched_cpus->map[unmatched_nr++] = cpus->map[i];
|
||||
perf_cpu_map__for_each_cpu(cpu, i, cpus) {
|
||||
if (!perf_cpu_map__has(pmu_cpus, cpu))
|
||||
unmatched_cpus->map[unmatched_nr++] = cpu;
|
||||
else
|
||||
matched_cpus->map[matched_nr++] = cpus->map[i];
|
||||
matched_cpus->map[matched_nr++] = cpu;
|
||||
}
|
||||
|
||||
unmatched_cpus->nr = unmatched_nr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче