Re: [PATCH 04/40] perf tools: Create separate mmap for dummy tracking event

From: Namhyung Kim
Date: Tue May 19 2015 - 02:34:24 EST


Hi Jiri,

On Mon, May 18, 2015 at 08:07:13PM +0200, Jiri Olsa wrote:
> On Mon, May 18, 2015 at 09:30:19AM +0900, Namhyung Kim wrote:
>
> SNIP
>
> > -static int perf_evlist__alloc_mmap(struct perf_evlist *evlist)
> > +static int perf_evlist__alloc_mmap(struct perf_evlist *evlist, bool track_mmap)
> > {
> > evlist->nr_mmaps = cpu_map__nr(evlist->cpus);
> > if (cpu_map__empty(evlist->cpus))
> > evlist->nr_mmaps = thread_map__nr(evlist->threads);
> > evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
> > - return evlist->mmap != NULL ? 0 : -ENOMEM;
> > + if (evlist->mmap == NULL)
> > + return -ENOMEM;
> > +
> > + if (track_mmap) {
> > + evlist->track_mmap = calloc(evlist->nr_mmaps,
> > + sizeof(struct perf_mmap));
> > + if (evlist->track_mmap == NULL) {
> > + zfree(&evlist->mmap);
> > + return -ENOMEM;
> > + }
> > + }
> > + return 0;
> > }
> >
> > struct mmap_params {
> > - int prot;
> > - int mask;
> > + int prot;
> > + size_t len;
> > struct auxtrace_mmap_params auxtrace_mp;
> > };
> >
> > -static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
> > +static int __perf_evlist__mmap(struct perf_evlist *evlist __maybe_unused,
> > + struct perf_mmap *pmmap,
> > struct mmap_params *mp, int fd)
>
> hum, looks like this patch should be separated to:
>
> - one that makes __perf_evlist__mmap use perf_mmap directly
> and moves auxtrace_mmap__mmap..
> also __perf_evlist__mmap should be renamed (perf_mmap__mmap? ;-) )
> and evlist arg removed, because it's not used..
>
> - one that adds dummy tracing events mmapping
>
> maybe also separate the code that alloc and free evlist->track_mmap
> with perf_evlist__mmap_desc stuff, might help the readability..

OK, will do.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/