From 9fdbf671ba7e8adb2cbb93d716232ebcab55f6bd Mon Sep 17 00:00:00 2001 From: Luigi Semenzato Date: Tue, 21 Aug 2012 14:52:20 -0700 Subject: [PATCH] perf tools: do not flush maps on COMM for perf report This fixes a long-standing bug caused by the lack of separate COMM and EXEC record types, which makes "perf report" lose track of symbols when a process renames itself. With this fix (suggested by Stephane Eranian), a COMM (rename) no longer flushes the maps, which is the correct behavior. An EXEC also no longer flushes the maps, but this doesn't matter because as new mappings are created (for the executable and the libraries) the old mappings are automatically removed. This is not by accident: the functionality is necessary because DLLs can be explicitly loaded at any time with dlopen(), possibly on top of existing text, so "perf report" handles correctly the clobbering of new mappings on top of old ones. An alternative patch (which I proposed earlier) would be to introduce a separate PERF_RECORD_EXEC type, but it is a much larger change (about 300 lines) and is not necessary. Signed-off-by: Luigi Semenzato Tested-by: Stephane Eranian Acked-by: Stephane Eranian Cc: "Eric W. Biederman" Cc: "Rafael J. Wysocki" Cc: Alexander Viro Cc: Andi Kleen Cc: Andrew Morton Cc: David Ahern Cc: Frederic Weisbecker Cc: Greg Kroah-Hartman Cc: Ingo Molnar Cc: Lucas De Marchi Cc: Namhyung Kim Cc: Oleg Nesterov Cc: Olof Johansson Cc: Paul Gortmaker Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Robert Richter Cc: Sonny Rao Cc: Stephane Eranian Cc: Stephen Wilson Cc: Tejun Heo Cc: Vasiliy Kulikov Link: http://lkml.kernel.org/r/1345585940-6497-1-git-send-email-semenzato@chromium.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/thread.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index fb4b7ea..8b3e593 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -39,7 +39,6 @@ int thread__set_comm(struct thread *self, const char *comm) err = self->comm == NULL ? -ENOMEM : 0; if (!err) { self->comm_set = true; - map_groups__flush(&self->mg); } return err; } -- 2.7.4