diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-10-20 08:18:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-10-22 11:37:51 -0400 |
commit | 4291bf5cb93918232f88a3a70d8f70a72fbb6ab0 (patch) | |
tree | 15d5da4be4871ed70f102ceb61af184a1df29450 | |
parent | b7e8452b860c299f342a012922bdd9ab8f2bb722 (diff) |
perf trace: Drop addr_location refcounts
When we use machine__resolve() we grab a reference to
addr_location.thread (and in the future to other elements there) via
machine__findnew_thread(), so we must pair that with
addr_location__put(), else we'll never drop that thread when it exits
and no other remaining data structures have pointers to it. Fix it.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-ivg9hifzeuokb1f5jxc2wob4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-trace.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 74638034861c..77b8748ad5ed 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1814,12 +1814,14 @@ static int trace__resolve_callchain(struct trace *trace, struct perf_evsel *evse | |||
1814 | int max_stack = evsel->attr.sample_max_stack ? | 1814 | int max_stack = evsel->attr.sample_max_stack ? |
1815 | evsel->attr.sample_max_stack : | 1815 | evsel->attr.sample_max_stack : |
1816 | trace->max_stack; | 1816 | trace->max_stack; |
1817 | int err; | ||
1817 | 1818 | ||
1818 | if (machine__resolve(trace->host, &al, sample) < 0 || | 1819 | if (machine__resolve(trace->host, &al, sample) < 0) |
1819 | thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack)) | ||
1820 | return -1; | 1820 | return -1; |
1821 | 1821 | ||
1822 | return 0; | 1822 | err = thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack); |
1823 | addr_location__put(&al); | ||
1824 | return err; | ||
1823 | } | 1825 | } |
1824 | 1826 | ||
1825 | static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sample) | 1827 | static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sample) |