]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
perf events: Fix mmap offset determination
authorDave Martin <dave.martin@linaro.org>
Tue, 3 Aug 2010 11:48:35 +0000 (12:48 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 4 Aug 2010 15:41:23 +0000 (12:41 -0300)
Fix buggy-looking code which unnecessarily adjusts the file offset
fields read from /proc/*/maps.

This may have gone unnoticed since the offset is usually 0 (and the
logic in util/symbol.c may work incorrectly for other offset values).

Commiter note:

This fixes a bug introduced in 4af8b35, there is no need to shift pgoff
twice, the show_map_vma routine in fs/proc/task_mmu.c already converts
it from the number of pages to the size in bytes, and that is what
appears in /proc/PID/map.

Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Will Deacon <Will.Deacon@arm.com>
LKML-Reference: <1280836116-6654-2-git-send-email-dave.martin@linaro.org>
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/event.c

index 6b0db5577929111abb006f444343c05c1dc31069..db8a1d4b4d8c27277a21623a050f03b1b1946024 100644 (file)
@@ -151,7 +151,6 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
                        continue;
                pbf += n + 3;
                if (*pbf == 'x') { /* vm_exec */
-                       u64 vm_pgoff;
                        char *execname = strchr(bf, '/');
 
                        /* Catch VDSO */
@@ -162,12 +161,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
                                continue;
 
                        pbf += 3;
-                       n = hex2u64(pbf, &vm_pgoff);
-                       /* pgoff is in bytes, not pages */
-                       if (n >= 0)
-                               ev.mmap.pgoff = vm_pgoff << getpagesize();
-                       else
-                               ev.mmap.pgoff = 0;
+                       n = hex2u64(pbf, &ev.mmap.pgoff);
 
                        size = strlen(execname);
                        execname[size - 1] = '\0'; /* Remove \n */