Re: [tip:perf/core] perf: Add non-exec mmap() tracking

Pekka Enberg
2010-06-09T10:44:23Z

H Eric,

On Wed, Jun 9, 2010 at 1:15 PM, tip-bot for Eric B Munson
<ebmunson@us.ibm.com> wrote:
> Commit-ID:  3af9e859281bda7eb7c20b51879cf43aa788ac2e
> Gitweb:     http://git.kernel.org/tip/3af9e859281bda7eb7c20b51879cf43aa788ac2e
> Author:     Eric B Munson <ebmunson@us.ibm.com>
> AuthorDate: Tue, 18 May 2010 15:30:49 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 9 Jun 2010 11:12:34 +0200
>
> perf: Add non-exec mmap() tracking
>
> Add the capacility to track data mmap()s. This can be used together
> with PERF_SAMPLE_ADDR for data profiling.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> [Updated code for stable perf ABI]
> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> LKML-Reference: <1274193049-25997-1-git-send-email-ebmunson@us.ibm.com>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

> @@ -3830,6 +3834,14 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
>                if (!vma->vm_mm) {
>                        name = strncpy(tmp, "[vdso]", sizeof(tmp));
>                        goto got_name;
> +               } else if (vma->vm_start <= vma->vm_mm->start_brk &&
> +                               vma->vm_end >= vma->vm_mm->brk) {
> +                       name = strncpy(tmp, "[heap]", sizeof(tmp));
> +                       goto got_name;
> +               } else if (vma->vm_start <= vma->vm_mm->start_stack &&
> +                               vma->vm_end >= vma->vm_mm->start_stack) {
> +                       name = strncpy(tmp, "[stack]", sizeof(tmp));
> +                       goto got_name;
>                }
>
>                name = strncpy(tmp, "//anon", sizeof(tmp));

Doesn't this change here break the JIT generated code region detection
in map__new() of tools/perf/util/map.c? We generate a new
"/tmp/perf-<pid>.map" filename for anonymous memory regions and check
for that in dso__load() of tools/perf/util/symbol.c.

Pekka