On Wed, 2010-06-16 at 18:41 +0200, stephane eranian wrote: > On Wed, Jun 16, 2010 at 4:52 PM, Peter Zijlstra <pet...@infradead.org> wrote: > > On Wed, 2010-06-16 at 16:40 +0200, Stephane Eranian wrote: > >> This leads me to another point. For per-thread sampling, why > >> do we need to record mmap() events happening *outside* of > >> the process? I can understand the exception of kernel modules. > > > > How does that happen? The per-thread events should be on the per-task > > context, so another task's mmap() events should never end up there. > > > > I don't see the test that says the vma does not belong to the current task. > I also don't see anything in perf_event_mmap_match(). > > It does seem to work as you said in recent kernels, though. So I am certainly > missing something here.
vma's are always part of the current task, its impossible to call mmap() on another process's address space. Look at the tail of perf_event_mmap_event(), it does: rcu_read_lock(); cpuctx = &get_cpu_var(perf_cpu_context); perf_event_mmap_ctx(&cpuctx->ctx, mmap_event, vma->vm_flags & VM_EXEC); ctx = rcu_dereference(current->perf_event_ctxp); if (ctx) perf_event_mmap_ctx(ctx, mmap_event, vma->vm_flags & VM_EXEC); put_cpu_var(perf_cpu_context); rcu_read_unlock(); There it traverses the per-cpu context and the per-task context. ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel