[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191106163415.GO30214@krava>
Date: Wed, 6 Nov 2019 17:34:15 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v4 5/9] perf stat: Use affinity for closing file
descriptors
On Mon, Nov 04, 2019 at 04:25:18PM -0800, Andi Kleen wrote:
SNIP
> ---
> tools/perf/lib/evsel.c | 27 +++++++++++++++++++++------
> tools/perf/lib/include/perf/evsel.h | 1 +
> tools/perf/util/evlist.c | 29 +++++++++++++++++++++++++++--
> tools/perf/util/evsel.h | 1 +
> 4 files changed, 50 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/lib/evsel.c b/tools/perf/lib/evsel.c
> index 5a89857b0381..ea775dacbd2d 100644
> --- a/tools/perf/lib/evsel.c
> +++ b/tools/perf/lib/evsel.c
> @@ -114,16 +114,23 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus,
> return err;
> }
>
> +static void perf_evsel__close_fd_cpu(struct perf_evsel *evsel, int cpu)
> +{
> + int thread;
> +
> + for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) {
> + if (FD(evsel, cpu, thread) >= 0)
> + close(FD(evsel, cpu, thread));
> + FD(evsel, cpu, thread) = -1;
> + }
> +}
> +
> void perf_evsel__close_fd(struct perf_evsel *evsel)
> {
> - int cpu, thread;
> + int cpu;
>
> for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++)
> - for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) {
> - if (FD(evsel, cpu, thread) >= 0)
> - close(FD(evsel, cpu, thread));
> - FD(evsel, cpu, thread) = -1;
> - }
> + perf_evsel__close_fd_cpu(evsel, cpu);
> }
>
> void perf_evsel__free_fd(struct perf_evsel *evsel)
> @@ -141,6 +148,14 @@ void perf_evsel__close(struct perf_evsel *evsel)
> perf_evsel__free_fd(evsel);
> }
>
> +void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu)
> +{
> + if (evsel->fd == NULL)
> + return;
> +
> + perf_evsel__close_fd_cpu(evsel, cpu);
> +}
> +
please move the perf_evsel__close_cpu addition into separate patch
thanks,
jirka
Powered by blists - more mailing lists