* [PATCH v1] perf test: Fix leak in "Synthesize attr update" test
@ 2025-03-05 19:19 Ian Rogers
2025-03-06 9:47 ` James Clark
2025-03-07 18:09 ` Namhyung Kim
0 siblings, 2 replies; 3+ messages in thread
From: Ian Rogers @ 2025-03-05 19:19 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
linux-kernel
The own_cpus map variable may be non-NULL and hold a reference, in
particular on hybrid machines. Do a put before overwriting the
variable to avoid a memory leak.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/event_update.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
index d6b4ce3ef4ee..9301fde11366 100644
--- a/tools/perf/tests/event_update.c
+++ b/tools/perf/tests/event_update.c
@@ -109,6 +109,7 @@ static int test__event_update(struct test_suite *test __maybe_unused, int subtes
TEST_ASSERT_VAL("failed to synthesize attr update name",
!perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name));
+ perf_cpu_map__put(evsel->core.own_cpus);
evsel->core.own_cpus = perf_cpu_map__new("1,2,3");
TEST_ASSERT_VAL("failed to synthesize attr update cpus",
--
2.48.1.711.g2feabab25a-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1] perf test: Fix leak in "Synthesize attr update" test
2025-03-05 19:19 [PATCH v1] perf test: Fix leak in "Synthesize attr update" test Ian Rogers
@ 2025-03-06 9:47 ` James Clark
2025-03-07 18:09 ` Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: James Clark @ 2025-03-06 9:47 UTC (permalink / raw)
To: Ian Rogers, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, Kan Liang, linux-perf-users, linux-kernel
On 05/03/2025 7:19 pm, Ian Rogers wrote:
> The own_cpus map variable may be non-NULL and hold a reference, in
> particular on hybrid machines. Do a put before overwriting the
> variable to avoid a memory leak.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/tests/event_update.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
> index d6b4ce3ef4ee..9301fde11366 100644
> --- a/tools/perf/tests/event_update.c
> +++ b/tools/perf/tests/event_update.c
> @@ -109,6 +109,7 @@ static int test__event_update(struct test_suite *test __maybe_unused, int subtes
> TEST_ASSERT_VAL("failed to synthesize attr update name",
> !perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name));
>
> + perf_cpu_map__put(evsel->core.own_cpus);
> evsel->core.own_cpus = perf_cpu_map__new("1,2,3");
>
> TEST_ASSERT_VAL("failed to synthesize attr update cpus",
Reviewed-by: James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1] perf test: Fix leak in "Synthesize attr update" test
2025-03-05 19:19 [PATCH v1] perf test: Fix leak in "Synthesize attr update" test Ian Rogers
2025-03-06 9:47 ` James Clark
@ 2025-03-07 18:09 ` Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-03-07 18:09 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, linux-perf-users, linux-kernel, Ian Rogers
On Wed, 05 Mar 2025 11:19:31 -0800, Ian Rogers wrote:
> The own_cpus map variable may be non-NULL and hold a reference, in
> particular on hybrid machines. Do a put before overwriting the
> variable to avoid a memory leak.
>
>
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-07 18:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 19:19 [PATCH v1] perf test: Fix leak in "Synthesize attr update" test Ian Rogers
2025-03-06 9:47 ` James Clark
2025-03-07 18:09 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox