Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755274AbbLJIR0 (ORCPT ); Thu, 10 Dec 2015 03:17:26 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55116 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbbLJIRY (ORCPT ); Thu, 10 Dec 2015 03:17:24 -0500 Date: Thu, 10 Dec 2015 00:17:05 -0800 From: tip-bot for Masami Hiramatsu Message-ID: Cc: masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, mingo@kernel.org, jolsa@redhat.com, adrian.hunter@intel.com, tglx@linutronix.de, hpa@zytor.com, a.p.zijlstra@chello.nl Reply-To: namhyung@kernel.org, masami.hiramatsu.pt@hitachi.com, mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, jolsa@redhat.com, tglx@linutronix.de, a.p.zijlstra@chello.nl, hpa@zytor.com In-Reply-To: <20151209021131.10245.41485.stgit@localhost.localdomain> References: <20151209021131.10245.41485.stgit@localhost.localdomain> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Fix maps__fixup_overlappings to put used maps Git-Commit-ID: d91130e90a005876b488b6d52b743149d95b4a59 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3458 Lines: 92 Commit-ID: d91130e90a005876b488b6d52b743149d95b4a59 Gitweb: http://git.kernel.org/tip/d91130e90a005876b488b6d52b743149d95b4a59 Author: Masami Hiramatsu AuthorDate: Wed, 9 Dec 2015 11:11:31 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 9 Dec 2015 13:42:00 -0300 perf tools: Fix maps__fixup_overlappings to put used maps Since the __map_groups__insert got the given map, we don't need to keep it. So put the maps. Refcnt debugger shows that map_groups__fixup_overlappings() got a map twice but the group released it just once. This pattern usually indicates the leak happens in caller site. ---- ==== [0] ==== Unreclaimed map@0x39d3ae0 Refcount +1 => 1 at ./perf(map_groups__fixup_overlappings+0x335) [0x4c1865] ./perf(thread__insert_map+0x30) [0x4c8e00] ./perf(machine__process_mmap2_event+0x106) [0x4bd876] ./perf() [0x4c378e] ./perf() [0x4c4393] ./perf(perf_session__process_events+0x38a) [0x4c654a] ./perf(cmd_record+0xe24) [0x42fc94] ./perf() [0x47b745] ./perf(main+0x617) [0x422547] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5] ./perf() [0x4226bd] Refcount +1 => 2 at ./perf(map_groups__fixup_overlappings+0x3c5) [0x4c18f5] ./perf(thread__insert_map+0x30) [0x4c8e00] ./perf(machine__process_mmap2_event+0x106) [0x4bd876] ./perf() [0x4c378e] ./perf() [0x4c4393] ./perf(perf_session__process_events+0x38a) [0x4c654a] ./perf(cmd_record+0xe24) [0x42fc94] ./perf() [0x47b745] ./perf(main+0x617) [0x422547] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5] ./perf() [0x4226bd] Refcount -1 => 1 at ./perf(map_groups__exit+0x92) [0x4c0962] ./perf(map_groups__put+0x60) [0x4c0bc0] ./perf(thread__put+0x90) [0x4c8a40] ./perf(machine__delete_threads+0x7e) [0x4bad9e] ./perf(perf_session__delete+0x4f) [0x4c499f] ./perf(cmd_record+0xb6d) [0x42f9dd] ./perf() [0x47b745] ./perf(main+0x617) [0x422547] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5] ./perf() [0x4226bd] ---- Signed-off-by: Masami Hiramatsu Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20151209021131.10245.41485.stgit@localhost.localdomain Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/map.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 7b1c720..171b6d1 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -691,6 +691,7 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp __map_groups__insert(pos->groups, before); if (verbose >= 2) map__fprintf(before, fp); + map__put(before); } if (map->end < pos->end) { @@ -705,6 +706,7 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp __map_groups__insert(pos->groups, after); if (verbose >= 2) map__fprintf(after, fp); + map__put(after); } put_map: map__put(pos); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/