aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-record.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f3679c44d3f3..f302cc937ca5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -40,6 +40,7 @@
40#include <unistd.h> 40#include <unistd.h>
41#include <sched.h> 41#include <sched.h>
42#include <sys/mman.h> 42#include <sys/mman.h>
43#include <asm/bug.h>
43 44
44 45
45struct record { 46struct record {
@@ -98,6 +99,13 @@ static int record__mmap_read(struct record *rec, int idx)
98 rec->samples++; 99 rec->samples++;
99 100
100 size = head - old; 101 size = head - old;
102 if (size > (unsigned long)(md->mask) + 1) {
103 WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n");
104
105 md->prev = head;
106 perf_evlist__mmap_consume(rec->evlist, idx);
107 return 0;
108 }
101 109
102 if ((old & md->mask) + size != (head & md->mask)) { 110 if ((old & md->mask) + size != (head & md->mask)) {
103 buf = &data[old & md->mask]; 111 buf = &data[old & md->mask];