[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YS6HXQ1DOA4uZVht@kernel.org>
Date: Tue, 31 Aug 2021 16:47:41 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Riccardo Mancini <rickyman7@...il.com>
Cc: Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: Re: [RFC PATCH v1 22/37] perf evsel: move test_attr__open to success
path in evsel__open_cpu
Em Sat, Aug 21, 2021 at 11:19:28AM +0200, Riccardo Mancini escreveu:
> test_attr__open ignores the fd if -1, therefore it is safe to move it to
> the success path (fd >= 0).
Nicely spotted, applied.
- Arnaldo
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
> tools/perf/util/evsel.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index a1a88607fd59efcb..d2b0391569286080 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -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) {
> --
> 2.31.1
--
- Arnaldo
Powered by blists - more mailing lists