]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
libperf: Adopt perf_mmap__get() function from tools/perf
authorJiri Olsa <jolsa@kernel.org>
Mon, 7 Oct 2019 12:53:13 +0000 (14:53 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 10 Oct 2019 12:53:27 +0000 (09:53 -0300)
Move perf_mmap__get() from tools/perf to libperf in the internal header
internal/mmap.h.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20191007125344.14268-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c
tools/perf/lib/include/internal/mmap.h
tools/perf/lib/mmap.c
tools/perf/util/evlist.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h

index f05e8b7955e4c169071c615e32003def7892fcaf..025a12b57325d1e0a5698086f8eb37cc4406cb30 100644 (file)
@@ -293,7 +293,7 @@ static int record__aio_pushfn(struct mmap *map, void *to, void *buf, size_t size
                 * after started aio request completion or at record__aio_push()
                 * if the request failed to start.
                 */
-               perf_mmap__get(map);
+               perf_mmap__get(&map->core);
        }
 
        aio->size += size;
index 7067b70c6f6197450e2df6bfb427061e57c0569e..2e68974bffb4a80f55dc5b6c280c43f9b51798ec 100644 (file)
@@ -39,5 +39,6 @@ size_t perf_mmap__mmap_len(struct perf_mmap *map);
 void perf_mmap__init(struct perf_mmap *map, bool overwrite);
 int perf_mmap__mmap(struct perf_mmap *map, struct perf_mmap_param *mp,
                    int fd, int cpu);
+void perf_mmap__get(struct perf_mmap *map);
 
 #endif /* __LIBPERF_INTERNAL_MMAP_H */
index b216a7db857fb51f073fc7bf3e69358c1ed63d2f..b765e0505bb63e5d23fd9e2f6056c219dbb64088 100644 (file)
@@ -31,3 +31,8 @@ int perf_mmap__mmap(struct perf_mmap *map, struct perf_mmap_param *mp,
        map->cpu = cpu;
        return 0;
 }
+
+void perf_mmap__get(struct perf_mmap *map)
+{
+       refcount_inc(&map->refcnt);
+}
index f9781de0e61e953088faf392029991328839f9dd..dc5b36069d4cfacbd5bb9abe5c3451d8e2984ecb 100644 (file)
@@ -701,7 +701,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx,
                        if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0)
                                return -1;
 
-                       perf_mmap__get(&maps[idx]);
+                       perf_mmap__get(&maps[idx].core);
                }
 
                revent = perf_evlist__should_poll(evlist, evsel) ? POLLIN : 0;
index acef6e3f6b8017148c92caf71be0fcc18191d42d..be691b58d8abbd3791c434905cd9340aa0bd719b 100644 (file)
@@ -110,11 +110,6 @@ static bool perf_mmap__empty(struct mmap *map)
        return perf_mmap__read_head(map) == map->core.prev && !map->auxtrace_mmap.base;
 }
 
-void perf_mmap__get(struct mmap *map)
-{
-       refcount_inc(&map->core.refcnt);
-}
-
 void perf_mmap__put(struct mmap *map)
 {
        BUG_ON(map->core.base && refcount_read(&map->core.refcnt) == 0);
index a60e6ead7255350053f5edc073690e7fd31c3c46..a73402ee8fe0b04697e06f26eb29a01a5f71fe1d 100644 (file)
@@ -45,7 +45,6 @@ struct mmap_params {
 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu);
 void perf_mmap__munmap(struct mmap *map);
 
-void perf_mmap__get(struct mmap *map);
 void perf_mmap__put(struct mmap *map);
 
 void perf_mmap__consume(struct mmap *map);