[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-ee023de05f35484691f7d9e5c1f92195ac4d64d2@git.kernel.org>
Date: Fri, 16 Feb 2018 01:37:18 -0800
From: tip-bot for Kan Liang <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: jolsa@...nel.org, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, tglx@...utronix.de,
linux-kernel@...r.kernel.org, namhyung@...nel.org,
ak@...ux.intel.com, acme@...hat.com, wangnan0@...wei.com,
kan.liang@...el.com, yao.jin@...ux.intel.com
Subject: [tip:perf/urgent] perf mmap: Introduce perf_mmap__read_done()
Commit-ID: ee023de05f35484691f7d9e5c1f92195ac4d64d2
Gitweb: https://git.kernel.org/tip/ee023de05f35484691f7d9e5c1f92195ac4d64d2
Author: Kan Liang <kan.liang@...el.com>
AuthorDate: Thu, 18 Jan 2018 13:26:22 -0800
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 15 Feb 2018 09:53:15 -0300
perf mmap: Introduce perf_mmap__read_done()
The direction of overwrite mode is backward. The last perf_mmap__read()
will set tail to map->prev. Need to correct the map->prev to head which
is the end of next read.
It will be used later.
Signed-off-by: Kan Liang <kan.liang@...el.com>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Jin Yao <yao.jin@...ux.intel.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-8-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/mmap.c | 11 +++++++++++
tools/perf/util/mmap.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index 125bfda..4f59eae 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -338,3 +338,14 @@ int perf_mmap__push(struct perf_mmap *md, bool overwrite,
out:
return rc;
}
+
+/*
+ * Mandatory for overwrite mode
+ * The direction of overwrite mode is backward.
+ * The last perf_mmap__read() will set tail to map->prev.
+ * Need to correct the map->prev to head which is the end of next read.
+ */
+void perf_mmap__read_done(struct perf_mmap *map)
+{
+ map->prev = perf_mmap__read_head(map);
+}
diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h
index 9ab2b48..95549d4 100644
--- a/tools/perf/util/mmap.h
+++ b/tools/perf/util/mmap.h
@@ -96,4 +96,5 @@ size_t perf_mmap__mmap_len(struct perf_mmap *map);
int perf_mmap__read_init(struct perf_mmap *md, bool overwrite,
u64 *startp, u64 *endp);
+void perf_mmap__read_done(struct perf_mmap *map);
#endif /*__PERF_MMAP_H */
Powered by blists - more mailing lists