提交 ebfb045a 编写于 作者: R Riccardo Mancini 提交者: Arnaldo Carvalho de Melo

perf evsel: Move test_attr__open() to success path in evsel__open_cpu()

test_attr__open() ignores the fd if -1, therefore it is safe to move it to
the success path (fd >= 0).
Signed-off-by: NRiccardo Mancini <rickyman7@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/b3baf11360ca96541c9631730614fd7d217496fc.1629490974.git.rickyman7@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 da7c3b46
......@@ -2011,11 +2011,6 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
bpf_counter__install_pe(evsel, cpu, fd);
if (unlikely(test_attr__enabled)) {
test_attr__open(&evsel->core.attr, pid, cpus->map[cpu],
fd, group_fd, evsel->open_flags);
}
if (fd < 0) {
err = -errno;
......@@ -2024,6 +2019,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
goto try_fallback;
}
if (unlikely(test_attr__enabled)) {
test_attr__open(&evsel->core.attr, pid, cpus->map[cpu],
fd, group_fd, evsel->open_flags);
}
pr_debug2_peo(" = %d\n", fd);
if (evsel->bpf_fd >= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册