[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 10 Oct 2019 10:11:04 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 07/36] libperf: Add perf_mmap__put() function
Em Mon, Oct 07, 2019 at 02:53:15PM +0200, Jiri Olsa escreveu:
> +++ b/tools/perf/lib/mmap.c
> @@ -3,10 +3,12 @@
> #include <internal/mmap.h>
> #include <internal/lib.h>
>
> -void perf_mmap__init(struct perf_mmap *map, bool overwrite)
> +void perf_mmap__init(struct perf_mmap *map, bool overwrite,
> + libperf_unmap_cb_t unmap_cb)
> {
> map->fd = -1;
> map->overwrite = overwrite;
> + map->unmap_cb = unmap_cb;
> refcount_set(&map->refcnt, 0);
> }
>
> @@ -40,9 +42,19 @@ void perf_mmap__munmap(struct perf_mmap *map)
> map->fd = -1;
> refcount_set(&map->refcnt, 0);
> }
> + if (map && map->unmap_cb)
> + map->unmap_cb(map);
> }
>
> void perf_mmap__get(struct perf_mmap *map)
> {
> refcount_inc(&map->refcnt);
> }
> +
> +void perf_mmap__put(struct perf_mmap *map)
> +{
> + BUG_ON(map->base && refcount_read(&map->refcnt) == 0);
Added missing linux/kernel.h to this file to pick up BUG_ON().
- Arnaldo
Powered by blists - more mailing lists