Re: [PATCH v7 2/4] libperf: Add evsel mmap support

From: Arnaldo Carvalho de Melo
Date: Wed Apr 14 2021 - 06:22:35 EST


Em Tue, Apr 13, 2021 at 02:07:57PM -0500, Rob Herring escreveu:
> On Tue, Apr 13, 2021 at 1:39 PM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > --- a/tools/lib/perf/evsel.c
> > > +int perf_evsel__mmap(struct perf_evsel *evsel, int pages)
> > > +{
> > > + int ret, cpu, thread;
> > Where is the counterpart?
>
> I was assuming implicitly unmapped when closing the fd(s), but looks
> like it's when exiting the process only.
>
> I.e. perf_evsel__munmap(), and it should be
> > called if perf_evsel__mmap() fails, right?
>
> If perf_evsel__mmap() fails, the caller shouldn't have to do anything
> WRT mmap, right? But if the perf_mmap__mmap() call fails, we do need
> some internal clean-up. I'll fix both.

You're right, thanks!

- Arnaldo