Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755378AbbLJIRn (ORCPT ); Thu, 10 Dec 2015 03:17:43 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55128 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932131AbbLJIRl (ORCPT ); Thu, 10 Dec 2015 03:17:41 -0500 Date: Thu, 10 Dec 2015 00:17:24 -0800 From: tip-bot for Masami Hiramatsu Message-ID: Cc: mingo@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, acme@redhat.com, jolsa@redhat.com, tglx@linutronix.de, a.p.zijlstra@chello.nl, hpa@zytor.com, masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com, tglx@linutronix.de, jolsa@redhat.com, acme@redhat.com, hpa@zytor.com, a.p.zijlstra@chello.nl, mingo@kernel.org, adrian.hunter@intel.com, namhyung@kernel.org In-Reply-To: <20151209021133.10245.93730.stgit@localhost.localdomain> References: <20151209021133.10245.93730.stgit@localhost.localdomain> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf machine: Fix machine.vmlinux_maps to make sure to clear the old one Git-Commit-ID: cc1121ab9687d660cc02f50b1a4974112f87a8e6 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: 2172 Lines: 53 Commit-ID: cc1121ab9687d660cc02f50b1a4974112f87a8e6 Gitweb: http://git.kernel.org/tip/cc1121ab9687d660cc02f50b1a4974112f87a8e6 Author: Masami Hiramatsu AuthorDate: Wed, 9 Dec 2015 11:11:33 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 9 Dec 2015 13:42:00 -0300 perf machine: Fix machine.vmlinux_maps to make sure to clear the old one Fix machine.vmlinux_maps to make sure to clear the old one if it is renewal. This can leak the previous maps on the vmlinux_maps because those are just overwritten. Signed-off-by: Masami Hiramatsu Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20151209021133.10245.93730.stgit@localhost.localdomain [ Simplified the memset, same end result ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/machine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index bfc289c..f5882b8 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -44,6 +44,8 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid) machine->comm_exec = false; machine->kernel_start = 0; + memset(machine->vmlinux_maps, 0, sizeof(machine->vmlinux_maps)); + machine->root_dir = strdup(root_dir); if (machine->root_dir == NULL) return -ENOMEM; @@ -770,6 +772,9 @@ int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) enum map_type type; u64 start = machine__get_running_kernel_start(machine, NULL); + /* In case of renewal the kernel map, destroy previous one */ + machine__destroy_kernel_maps(machine); + for (type = 0; type < MAP__NR_TYPES; ++type) { struct kmap *kmap; struct map *map; -- 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/