lkml.org 
[lkml]   [2020]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/26] perf: Introduce mmap3 version of mmap event
Em Mon, Sep 14, 2020 at 09:50:45PM +0200, Jiri Olsa escreveu:
> On Mon, Sep 14, 2020 at 12:31:34PM -0300, Arnaldo Carvalho de Melo wrote:
>
> SNIP
>
> > > > ---
> > > > include/uapi/linux/perf_event.h | 27 ++++++++++++++++++++++-
> > > > kernel/events/core.c | 38 +++++++++++++++++++++++++++------
> > > > 2 files changed, 57 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> > > > index 077e7ee69e3d..facfc3c673ed 100644
> > > > --- a/include/uapi/linux/perf_event.h
> > > > +++ b/include/uapi/linux/perf_event.h
> > > > @@ -384,7 +384,8 @@ struct perf_event_attr {
> > > > aux_output : 1, /* generate AUX records instead of events */
> > > > cgroup : 1, /* include cgroup events */
> > > > text_poke : 1, /* include text poke events */
> > > > - __reserved_1 : 30;
> > > > + mmap3 : 1, /* include bpf events */
> > > > + __reserved_1 : 29;
> > > >
> > > what happens if I set mmap3 and mmap2?
> > >
> > > I think using mmap3 for every mmap may be overkill as you add useless
> > > 20 bytes to an mmap record.
> >
> > So use just PERF_RECORD_MMAP2.
> >
> > I think if the user says: I need buildids, then, in kernels with support
> > for getting the buildid in MMAP records, use it as its more accurate,
> > otherwise fall back to traversing all records at the end to go over lots
> > of files haversting those build-ids.
>
> ok, so special record option to enable this
>
> >
> > If the user says I don't want build-ids, nothing changes, no collection
> > at the end, perf continues using PERF_RECORD_MMAP2.
>
> and that's -B option in record

Yeah, so if -B is used, MMAP2, otherwise, the best available option,
which is MMAP3, which by now means more how you tweak the misc bits and
what you collect, buildids or just the maj/min/ino :)

- Arnaldo

> >
> > > I am not sure if your code handles the case where mmap3 is not needed
> > > because there is no buildid, e.g, anonymous memory.
> > > It seems to me you've written the patch in such a way that if the user
> > > tool supports mmap3, then it supersedes mmap2, and thus
> > > you need all the fields of mmap2. But if could be more interesting to
> > > return either MMAP2 or MMAP3 depending on tool support
> > > and type of mmap, that would certainly save 20 bytes on any anon mmap.
> > > But maybe that logic is already in your patch and I missed it.
> >
> > Right, it should take into account if the user asked for build-ids or
> > not in addition to checking if the kernel supports MMAP3.
>
> right, thanks,
>
> jirka
>

--

- Arnaldo

\
 
 \ /
  Last update: 2020-09-15 00:41    [W:0.091 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site