[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190913132355.21634-17-jolsa@kernel.org>
Date: Fri, 13 Sep 2019 15:22:58 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Michael Petlan <mpetlan@...hat.com>
Subject: [PATCH 16/73] libperf: Add overwrite to struct perf_mmap
Move overwrite from tools/perf's mmap to libperf's perf_mmap struct.
Link: http://lkml.kernel.org/n/tip-5vhlcccldyoa0qceqrnm8pk0@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/lib/include/internal/mmap.h | 1 +
tools/perf/util/evlist.c | 2 +-
tools/perf/util/mmap.c | 12 ++++++------
tools/perf/util/mmap.h | 1 -
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h
index 5af28668913c..631e58dbc9e6 100644
--- a/tools/perf/lib/include/internal/mmap.h
+++ b/tools/perf/lib/include/internal/mmap.h
@@ -21,6 +21,7 @@ struct perf_mmap {
u64 prev;
u64 start;
u64 end;
+ bool overwrite;
};
#endif /* __LIBPERF_INTERNAL_MMAP_H */
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index f6e0bceec156..98827df5a40a 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -708,7 +708,7 @@ static struct mmap *evlist__alloc_mmap(struct evlist *evlist,
for (i = 0; i < evlist->nr_mmaps; i++) {
map[i].core.fd = -1;
- map[i].overwrite = overwrite;
+ 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
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index 6ce70ff005cb..a8850ce2c2ff 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -93,12 +93,12 @@ union perf_event *perf_mmap__read_event(struct mmap *map)
return NULL;
/* non-overwirte doesn't pause the ringbuffer */
- if (!map->overwrite)
+ if (!map->core.overwrite)
map->core.end = perf_mmap__read_head(map);
event = perf_mmap__read(map, &map->core.start, map->core.end);
- if (!map->overwrite)
+ if (!map->core.overwrite)
map->core.prev = map->core.start;
return event;
@@ -124,7 +124,7 @@ void perf_mmap__put(struct mmap *map)
void perf_mmap__consume(struct mmap *map)
{
- if (!map->overwrite) {
+ if (!map->core.overwrite) {
u64 old = map->core.prev;
perf_mmap__write_tail(map, old);
@@ -447,15 +447,15 @@ static int __perf_mmap__read_init(struct mmap *md)
unsigned char *data = md->core.base + page_size;
unsigned long size;
- md->core.start = md->overwrite ? head : old;
- md->core.end = md->overwrite ? old : head;
+ md->core.start = md->core.overwrite ? head : old;
+ md->core.end = md->core.overwrite ? old : head;
if ((md->core.end - md->core.start) < md->flush)
return -EAGAIN;
size = md->core.end - md->core.start;
if (size > (unsigned long)(md->core.mask) + 1) {
- if (!md->overwrite) {
+ if (!md->core.overwrite) {
WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n");
md->core.prev = head;
diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
index 16e4a5ca773d..1dea2abe1de5 100644
--- a/tools/perf/util/mmap.h
+++ b/tools/perf/util/mmap.h
@@ -22,7 +22,6 @@ struct aiocb;
*/
struct mmap {
struct perf_mmap core;
- bool overwrite;
struct auxtrace_mmap auxtrace_mmap;
char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8);
#ifdef HAVE_AIO_SUPPORT
--
2.21.0
Powered by blists - more mailing lists