]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf kvm: Delete histograms entries before exiting
authorLeo Yan <leo.yan@linaro.org>
Mon, 20 Mar 2023 06:16:19 +0000 (14:16 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 21 Mar 2023 13:06:08 +0000 (10:06 -0300)
It's good not to release resources for a program when kernel cleans up
memory space, this patch explicitly releases histograms entries with
hists__delete_entries().

Committer notice:

This helps with memory leak checkers, but may delay exiting a tool by
doing needless linked list traversals freeing lots of objects.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230320061619.29520-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-kvm.c

index 1e1cb5a9d0a2dda3f7e3235d6f5d9da4c26e42c8..fb9dc0dc46f9833758664f9f96109c5c048d1fce 100644 (file)
@@ -1528,6 +1528,8 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm)
        }
 
 out:
+       hists__delete_entries(&kvm_hists.hists);
+
        if (kvm->timerfd >= 0)
                close(kvm->timerfd);
 
@@ -1690,6 +1692,7 @@ static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm)
        kvm_display(kvm);
 
 exit:
+       hists__delete_entries(&kvm_hists.hists);
        return ret;
 }