[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YY/Krdzop6DY8KHv@kernel.org>
Date: Sat, 13 Nov 2021 11:24:45 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Sohaib Mohamed <sohaib.amhmd@...il.com>
Cc: irogers@...gle.com, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>,
André Almeida <andrealmeid@...labora.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf bench: futex: Fix memory leak of perf_cpu_map__new
Em Fri, Nov 12, 2021 at 10:11:33PM +0200, Sohaib Mohamed escreveu:
> ASan reports memory leaks while running:
>
> $ sudo ./perf bench futex all
>
> The leaks are caused by perf_cpu_map__new not being freed.
> This patch adds the missing perf_cpu_map__put since it calls
> cpu_map_delete implicitly.
>
> Fixes: 9c3516d1b850 ("libperf: Add perf_cpu_map__new()/perf_cpu_map__read() functions")
Thanks, applied.
- Arnaldo
> Signed-off-by: Sohaib Mohamed <sohaib.amhmd@...il.com>
> ---
> tools/perf/bench/futex-lock-pi.c | 1 +
> tools/perf/bench/futex-requeue.c | 1 +
> tools/perf/bench/futex-wake-parallel.c | 1 +
> tools/perf/bench/futex-wake.c | 1 +
> 4 files changed, 4 insertions(+)
>
> diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
> index 5d1fe9c35807..137890f78e17 100644
> --- a/tools/perf/bench/futex-lock-pi.c
> +++ b/tools/perf/bench/futex-lock-pi.c
> @@ -233,6 +233,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
> print_summary();
>
> free(worker);
> + perf_cpu_map__put(cpu);
> return ret;
> err:
> usage_with_options(bench_futex_lock_pi_usage, options);
> diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c
> index 97fe31fd3a23..f7a5ffebb940 100644
> --- a/tools/perf/bench/futex-requeue.c
> +++ b/tools/perf/bench/futex-requeue.c
> @@ -294,6 +294,7 @@ int bench_futex_requeue(int argc, const char **argv)
> print_summary();
>
> free(worker);
> + perf_cpu_map__put(cpu);
> return ret;
> err:
> usage_with_options(bench_futex_requeue_usage, options);
> diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c
> index e970e6b9ad53..0983f40b4b40 100644
> --- a/tools/perf/bench/futex-wake-parallel.c
> +++ b/tools/perf/bench/futex-wake-parallel.c
> @@ -329,6 +329,7 @@ int bench_futex_wake_parallel(int argc, const char **argv)
> print_summary();
>
> free(blocked_worker);
> + perf_cpu_map__put(cpu);
> return ret;
> }
> #endif /* HAVE_PTHREAD_BARRIER */
> diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c
> index 77f058a47790..2226a475e782 100644
> --- a/tools/perf/bench/futex-wake.c
> +++ b/tools/perf/bench/futex-wake.c
> @@ -222,5 +222,6 @@ int bench_futex_wake(int argc, const char **argv)
> print_summary();
>
> free(worker);
> + perf_cpu_map__put(cpu);
> return ret;
> }
> --
> 2.25.1
--
- Arnaldo
Powered by blists - more mailing lists