diff options
author | Leo Yan <leo.yan@linaro.org> | 2023-03-20 14:16:18 +0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-03-21 10:06:05 -0300 |
commit | f1e8f25980968f7c18f1eb977bd1d5fd716325a5 (patch) | |
tree | 644fc56a92772c32ab468b2ce27658e4bdf571e4 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | ea15483e7c55f73809cd9e208fff511966539ee5 (diff) | |
download | linux-f1e8f25980968f7c18f1eb977bd1d5fd716325a5.tar.gz linux-f1e8f25980968f7c18f1eb977bd1d5fd716325a5.tar.bz2 linux-f1e8f25980968f7c18f1eb977bd1d5fd716325a5.zip |
perf kvm: Reference count 'struct kvm_info'
hists__add_entry_ops() doesn't allocate a new histogram entry if it has
an existing entry for a KVM event, in this case, find_create_kvm_event()
allocates a 'struct kvm_info' but it's not used by any histograms and
never freed.
To fix the memory leak, this patch first introduces a refcnt and a set
of functions for refcnt operations on 'struct kvm_info'. When the data
structure is not anymore used (the refcnt hits zero) kvm_info__zput()
will free the memory used.
Committer:
Provide a nop version of kvm_info__zput() to be used when
HAVE_KVM_STAT_SUPPORT isn't defined as it is used unconditionally in
hists__findnew_entry() and hist_entry__delete().
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>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions