Prev: [tip:x86/asm] um, x86: Cast to (u64 *) inside set_64bit()
Next: scripts/kconfig/nconf.gui.c Fix warning: value computed is not used
From: Arnaldo Carvalho de Melo on 3 Aug 2010 10:40 Em Tue, Aug 03, 2010 at 12:48:35PM +0100, Dave Martin escreveu: > 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). > > I make assumptions about the intended design here. The cover note > accompanying this patch contains a more detailed explanation. > > Signed-off-by: Dave Martin <dave.martin(a)linaro.org> Doing some investigation here... 4af8b35d (Anton Blanchard 2010-04-03 164) pbf += 3; 4af8b35d (Anton Blanchard 2010-04-03 165) n = hex2u64(pbf, &vm_pgoff); 4af8b35d (Anton Blanchard 2010-04-03 166) /* pgoff is in bytes, not pages */ 4af8b35d (Anton Blanchard 2010-04-03 167) if (n >= 0) 4af8b35d (Anton Blanchard 2010-04-03 168) ev.mmap.pgoff = vm_pgoff << getpagesize(); 4af8b35d (Anton Blanchard 2010-04-03 169) else 4af8b35d (Anton Blanchard 2010-04-03 170) ev.mmap.pgoff = 0; commit 4af8b35db6634dd1e0d616de689582b6c93550af Author: Anton Blanchard <anton(a)samba.org> Date: Sat Apr 3 22:53:31 2010 +1100 perf symbols: Fill in pgoff in mmap synthesized events When we synthesize mmap events we need to fill in the pgoff field. I wasn't able to test this completely since I couldn't find an executable region with a non 0 offset. We will see it when we start doing data profiling. ------------------------ Yeah, not reassuring comment, looking at fs/proc/task_mmu.c we see: static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma) { struct mm_struct *mm = vma->vm_mm; struct file *file = vma->vm_file; int flags = vma->vm_flags; unsigned long ino = 0; unsigned long long pgoff = 0; dev_t dev = 0; int len; if (file) { struct inode *inode = vma->vm_file->f_path.dentry->d_inode; dev = inode->i_sb->s_dev; ino = inode->i_ino; pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; } seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", vma->vm_start, vma->vm_end, flags & VM_READ ? 'r' : '-', flags & VM_WRITE ? 'w' : '-', flags & VM_EXEC ? 'x' : '-', flags & VM_MAYSHARE ? 's' : 'p', pgoff, MAJOR(dev), MINOR(dev), ino, &len); ---------------------------------------------------------------------------- So yes, we're double shifting that, your patch is correct, applying it. > --- > tools/perf/util/event.c | 8 +------- > 1 files changed, 1 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c > index 6b0db55..db8a1d4 100644 > --- a/tools/perf/util/event.c > +++ b/tools/perf/util/event.c > @@ -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 */ > -- > 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |