From: Peter Zijlstra <peterz@infradead.org>
To: eranian@gmail.com
Cc: Stephane Eranian <eranian@google.com>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
davem@davemloft.net, fweisbec@gmail.com,
perfmon2-devel@lists.sf.net
Subject: Re: [RFC] perf/perf_events: misleading number of samples due to mmap()
Date: Wed, 16 Jun 2010 19:43:34 +0200 [thread overview]
Message-ID: <1276710214.1745.604.camel@laptop> (raw)
In-Reply-To: <AANLkTim1yFwS5g-s_2fMRHljjf5yMouoHb2Ulqj6V1AC@mail.gmail.com>
On Wed, 2010-06-16 at 18:41 +0200, stephane eranian wrote:
> On Wed, Jun 16, 2010 at 4:52 PM, Peter Zijlstra <peterz@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.
next prev parent reply other threads:[~2010-06-16 17:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-16 14:40 [RFC] perf/perf_events: misleading number of samples due to mmap() Stephane Eranian
2010-06-16 14:52 ` Peter Zijlstra
2010-06-16 16:41 ` stephane eranian
2010-06-16 17:15 ` stephane eranian
2010-06-16 17:43 ` Peter Zijlstra [this message]
2010-06-16 14:54 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276710214.1745.604.camel@laptop \
--to=peterz@infradead.org \
--cc=acme@infradead.org \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=perfmon2-devel@lists.sf.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox