[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <157111750177.12254.3319665333964310792.tip-bot2@tip-bot2>
Date: Tue, 15 Oct 2019 05:31:41 -0000
From: "tip-bot2 for Jiri Olsa" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Jiri Olsa <jolsa@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
linux-kernel@...r.kernel.org
Subject: [tip: perf/core] libperf: Add perf_mmap__init() function
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 353120b48d4f61288e4745b0c8a191784b11c0f4
Gitweb: https://git.kernel.org/tip/353120b48d4f61288e4745b0c8a191784b11c0f4
Author: Jiri Olsa <jolsa@...nel.org>
AuthorDate: Mon, 07 Oct 2019 14:53:09 +02:00
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitterDate: Thu, 10 Oct 2019 09:37:25 -03:00
libperf: Add perf_mmap__init() function
Add perf_mmap__init() function to initialize 'struct perf_mmap' objects.
Add it to a new mmap.c source file, that will carry all the mmap related
functions.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Michael Petlan <mpetlan@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lore.kernel.org/lkml/20191007125344.14268-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/lib/Build | 1 +
tools/perf/lib/include/internal/mmap.h | 2 ++
tools/perf/lib/mmap.c | 9 +++++++++
tools/perf/util/evlist.c | 5 ++---
4 files changed, 14 insertions(+), 3 deletions(-)
create mode 100644 tools/perf/lib/mmap.c
diff --git a/tools/perf/lib/Build b/tools/perf/lib/Build
index c31f1c1..2ef9a4e 100644
--- a/tools/perf/lib/Build
+++ b/tools/perf/lib/Build
@@ -3,6 +3,7 @@ libperf-y += cpumap.o
libperf-y += threadmap.o
libperf-y += evsel.o
libperf-y += evlist.o
+libperf-y += mmap.o
libperf-y += zalloc.o
libperf-y += xyarray.o
libperf-y += lib.o
diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h
index ba1e519..e25890d 100644
--- a/tools/perf/lib/include/internal/mmap.h
+++ b/tools/perf/lib/include/internal/mmap.h
@@ -29,4 +29,6 @@ struct perf_mmap {
char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8);
};
+void perf_mmap__init(struct perf_mmap *map, bool overwrite);
+
#endif /* __LIBPERF_INTERNAL_MMAP_H */
diff --git a/tools/perf/lib/mmap.c b/tools/perf/lib/mmap.c
new file mode 100644
index 0000000..3da6177
--- /dev/null
+++ b/tools/perf/lib/mmap.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <internal/mmap.h>
+
+void perf_mmap__init(struct perf_mmap *map, bool overwrite)
+{
+ map->fd = -1;
+ map->overwrite = overwrite;
+ refcount_set(&map->refcnt, 0);
+}
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e33b46a..6c8de08 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -629,8 +629,6 @@ static struct mmap *evlist__alloc_mmap(struct evlist *evlist,
return NULL;
for (i = 0; i < evlist->core.nr_mmaps; i++) {
- map[i].core.fd = -1;
- map[i].core.overwrite = overwrite;
/*
* When the perf_mmap() call is made we grab one refcount, plus
* one extra to let perf_mmap__consume() get the last
@@ -640,8 +638,9 @@ static struct mmap *evlist__alloc_mmap(struct evlist *evlist,
* Each PERF_EVENT_IOC_SET_OUTPUT points to this mmap and
* thus does perf_mmap__get() on it.
*/
- refcount_set(&map[i].core.refcnt, 0);
+ perf_mmap__init(&map[i].core, overwrite);
}
+
return map;
}
Powered by blists - more mailing lists