lkml.org 
[lkml]   [2019]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 43/73] libperf: Add perf_mmap__get function
Date
Move perf_mmap__get function under libperf
to internal header internal/mmap.h.

Link: http://lkml.kernel.org/n/tip-iq4yp3dsr2a4yzdkukholo8o@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-record.c | 2 +-
tools/perf/lib/include/internal/mmap.h | 1 +
tools/perf/lib/mmap.c | 5 +++++
tools/perf/util/evlist.c | 2 +-
tools/perf/util/mmap.c | 5 -----
tools/perf/util/mmap.h | 1 -
6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 40780434b23e..82f6bd6b1adc 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -290,7 +290,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;
diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h
index 5452ed7dabfe..372521cae06d 100644
--- a/tools/perf/lib/include/internal/mmap.h
+++ b/tools/perf/lib/include/internal/mmap.h
@@ -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 */
diff --git a/tools/perf/lib/mmap.c b/tools/perf/lib/mmap.c
index b216a7db857f..b765e0505bb6 100644
--- a/tools/perf/lib/mmap.c
+++ b/tools/perf/lib/mmap.c
@@ -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);
+}
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 8da573307734..0191d3b2eb20 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -676,7 +676,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;
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index 7096e9b130cd..a7e0b4afc176 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -109,11 +109,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);
diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
index aeb94d128354..f7ee0252db24 100644
--- a/tools/perf/util/mmap.h
+++ b/tools/perf/util/mmap.h
@@ -73,7 +73,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);
--
2.21.0
\
 
 \ /
  Last update: 2019-09-13 15:28    [W:0.253 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site