Re: [PATCH v11 1/3]: perf util: map data buffer for preserving collected data

From: Jiri Olsa
Date: Mon Oct 08 2018 - 08:39:04 EST


On Mon, Oct 08, 2018 at 03:03:18PM +0300, Alexey Budankov wrote:
> Hi,
>
> On 08.10.2018 13:50, Jiri Olsa wrote:
> > On Mon, Oct 08, 2018 at 09:14:29AM +0300, Alexey Budankov wrote:
> <SNIP>
> >>
> >> +#ifdef HAVE_AIO_SUPPORT
> >> +static void perf_mmap__aio_munmap(struct perf_mmap *map)
> >> +{
> >> + if (map->data)
> >> + zfree(&map->data);
> >> +}
> >
> > if we really need to keep this optional for compilation,
> > please make it as single block with dummy functions
> > for when it's not compiled in, like:
> >
> > #ifdef
> > static void perf_mmap__aio_munmap(struct perf_mmap *map)
> > {
> > if (map->data)
> > zfree(&map->data);
> > }
> > #else
> > static void perf_mmap__aio_munmap(struct perf_mmap *map) { }
> > #endif
>
> Ok.
>
> >
> > thanks,
> > jirka
> >
> >
> >> +#endif
> >> +
> >> void perf_mmap__munmap(struct perf_mmap *map)
> >> {
> >> +#ifdef HAVE_AIO_SUPPORT
> >> + perf_mmap__aio_munmap(map);
> >> +#endif
> >> if (map->base != NULL) {
> >> munmap(map->base, perf_mmap__mmap_len(map));
> >> map->base = NULL;
> >> @@ -164,8 +175,40 @@ void perf_mmap__munmap(struct perf_mmap *map)
> >> auxtrace_mmap__munmap(&map->auxtrace_mmap);
> >> }
>
> Well, let's go with stub functions design as opposite to pure
> conditional compilation. However this may, probably, result in
> unintended Perf tool binary size growth, even if NO_AIO is
> defined during compilation.

hum, empty functions are be optimized out

jirka