From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Cc: irogers@google.com, "Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"André Almeida" <andrealmeid@collabora.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@redhat.com>,
"Namhyung Kim" <namhyung@kernel.org>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf bench: futex: Fix memory leak of perf_cpu_map__new
Date: Sat, 13 Nov 2021 11:24:45 -0300 [thread overview]
Message-ID: <YY/Krdzop6DY8KHv@kernel.org> (raw)
In-Reply-To: <20211112201134.77892-1-sohaib.amhmd@gmail.com>
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@gmail.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
prev parent reply other threads:[~2021-11-13 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-12 20:11 [PATCH] perf bench: futex: Fix memory leak of perf_cpu_map__new Sohaib Mohamed
2021-11-13 14:24 ` Arnaldo Carvalho de Melo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YY/Krdzop6DY8KHv@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrealmeid@collabora.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=sohaib.amhmd@gmail.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox