perf mmap: Simplify perf_mmap__consume()
authorKan Liang <kan.liang@linux.intel.com>
Tue, 6 Mar 2018 15:36:05 +0000 (10:36 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Mar 2018 13:05:52 +0000 (10:05 -0300)
It isn't necessary to pass the 'overwrite' argument to
perf_mmap__consume().  Discard it.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1520350567-80082-6-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
15 files changed:
tools/perf/arch/x86/tests/perf-time-to-tsc.c
tools/perf/builtin-kvm.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/tests/code-reading.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/openat-syscall-tp-fields.c
tools/perf/tests/perf-record.c
tools/perf/tests/sw-clock.c
tools/perf/tests/switch-tracking.c
tools/perf/tests/task-exit.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h
tools/perf/util/python.c

index 7f82d91ef473e82029c2c0ffe825b54db59cbe0f..a9bc77df6a652b3d9681522a4a9579bf905258e8 100644 (file)
@@ -134,7 +134,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
                                comm2_time = sample.time;
                        }
 next_event:
-                       perf_mmap__consume(md, false);
+                       perf_mmap__consume(md);
                }
                perf_mmap__read_done(md);
        }
index d2703d3b83666cac140eefe184a406160681e78a..165c044616b6939e797f53cfe4147fdeedaff1cb 100644 (file)
@@ -760,7 +760,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
        while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
                err = perf_evlist__parse_sample_timestamp(evlist, event, &timestamp);
                if (err) {
-                       perf_mmap__consume(md, false);
+                       perf_mmap__consume(md);
                        pr_err("Failed to parse sample\n");
                        return -1;
                }
@@ -770,7 +770,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
                 * FIXME: Here we can't consume the event, as perf_session__queue_event will
                 *        point to it, and it'll get possibly overwritten by the kernel.
                 */
-               perf_mmap__consume(md, false);
+               perf_mmap__consume(md);
 
                if (err) {
                        pr_err("Failed to enqueue sample: %d\n", err);
index bb4f9fafd11d8304491af1fa7effe807428e5111..11b4a413039fe524cb25bbd4e94c871bae25c0bb 100644 (file)
@@ -879,7 +879,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
                } else
                        ++session->evlist->stats.nr_unknown_events;
 next_event:
-               perf_mmap__consume(md, opts->overwrite);
+               perf_mmap__consume(md);
        }
 
        perf_mmap__read_done(md);
index 5b81060a8117e2f7ee5020433ca736e551c55216..27eadf3018c6df2bc8365e326d865239a96e7e4f 100644 (file)
@@ -2522,7 +2522,7 @@ again:
 
                        trace__handle_event(trace, event, &sample);
 next_event:
-                       perf_mmap__consume(md, false);
+                       perf_mmap__consume(md);
 
                        if (interrupted)
                                goto out_disable;
index 03ed8c77b1bb69d11aea6a3e87af8d0f7dea5332..f7c199acb7ac86e1574399fb3a504313293864e9 100644 (file)
@@ -420,7 +420,7 @@ static int process_events(struct machine *machine, struct perf_evlist *evlist,
 
                while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
                        ret = process_event(machine, evlist, event, state);
-                       perf_mmap__consume(md, false);
+                       perf_mmap__consume(md);
                        if (ret < 0)
                                return ret;
                }
index 4590d8fb91ab86c4f8beceadb945e4d47355ec04..1f1db5965d05835db1c0be2128ca8d91695ea297 100644 (file)
@@ -42,7 +42,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm)
                            (pid_t)event->comm.tid == getpid() &&
                            strcmp(event->comm.comm, comm) == 0)
                                found += 1;
-                       perf_mmap__consume(md, false);
+                       perf_mmap__consume(md);
                }
                perf_mmap__read_done(md);
        }
index 44c58d69cd87e4e54a2b584aa63e6ea6fe760061..f473e106aebaf9aad97e7460cd627d3a63bc300e 100644 (file)
@@ -135,7 +135,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
                        goto out_delete_evlist;
                }
                nr_events[evsel->idx]++;
-               perf_mmap__consume(md, false);
+               perf_mmap__consume(md);
        }
        perf_mmap__read_done(md);
 
index 620b21023f722e6e3ee34e8b3918501bde95e521..7837ae93667922ff5d51a7776c56510f4e021439 100644 (file)
@@ -101,7 +101,7 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest
                                ++nr_events;
 
                                if (type != PERF_RECORD_SAMPLE) {
-                                       perf_mmap__consume(md, false);
+                                       perf_mmap__consume(md);
                                        continue;
                                }
 
index 31f3f70adca62b52bfd30a9d54e9e4cd77656375..6ff5f99b3e0e47ec15f7cb1af793d9a5f94e01c4 100644 (file)
@@ -272,7 +272,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
                                        ++errs;
                                }
 
-                               perf_mmap__consume(md, false);
+                               perf_mmap__consume(md);
                        }
                        perf_mmap__read_done(md);
                }
index e6320e267ba567149660f268c54c2b7054c40faa..b58297b9a83d74995cd7bb8d2c94fe29f1ad8bcc 100644 (file)
@@ -114,7 +114,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
                total_periods += sample.period;
                nr_samples++;
 next_event:
-               perf_mmap__consume(md, false);
+               perf_mmap__consume(md);
        }
        perf_mmap__read_done(md);
 
index 10c4dcdc2324a9a938233be44a73636e76eb9dd4..dbf9e20f7d56f44a299934e8dcb798c70e77ce91 100644 (file)
@@ -270,7 +270,7 @@ static int process_events(struct perf_evlist *evlist,
                while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
                        cnt += 1;
                        ret = add_event(evlist, &events, event);
-                        perf_mmap__consume(md, false);
+                        perf_mmap__consume(md);
                        if (ret < 0)
                                goto out_free_nodes;
                }
index 02b0888b72a33d383d9249d9e6aa98b488fc865c..5aa2e68e9d05e17bd8838f5846f52f11a67fc6cf 100644 (file)
@@ -120,7 +120,7 @@ retry:
                if (event->header.type == PERF_RECORD_EXIT)
                        nr_exit++;
 
-               perf_mmap__consume(md, false);
+               perf_mmap__consume(md);
        }
        perf_mmap__read_done(md);
 
index 8a2dac90056c63fc717e42116feb11710b85801a..62312e06d75b041bd6099625db074d27835e2af2 100644 (file)
@@ -118,7 +118,7 @@ void perf_mmap__put(struct perf_mmap *map)
                perf_mmap__munmap(map);
 }
 
-void perf_mmap__consume(struct perf_mmap *map, bool overwrite __maybe_unused)
+void perf_mmap__consume(struct perf_mmap *map)
 {
        if (!map->overwrite) {
                u64 old = map->prev;
@@ -260,7 +260,7 @@ int perf_mmap__read_init(struct perf_mmap *md, bool overwrite,
                        WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n");
 
                        md->prev = head;
-                       perf_mmap__consume(md, overwrite);
+                       perf_mmap__consume(md);
                        return -EAGAIN;
                }
 
@@ -314,7 +314,7 @@ int perf_mmap__push(struct perf_mmap *md, void *to,
        }
 
        md->prev = head;
-       perf_mmap__consume(md, md->overwrite);
+       perf_mmap__consume(md);
 out:
        return rc;
 }
index 65f5b26d86682f18da09166dda5f7be10ee4166e..043916a20de686e82c24f272d9205fee37b69c7f 100644 (file)
@@ -66,7 +66,7 @@ void perf_mmap__munmap(struct perf_mmap *map);
 void perf_mmap__get(struct perf_mmap *map);
 void perf_mmap__put(struct perf_mmap *map);
 
-void perf_mmap__consume(struct perf_mmap *map, bool overwrite);
+void perf_mmap__consume(struct perf_mmap *map);
 
 static inline u64 perf_mmap__read_head(struct perf_mmap *mm)
 {
index 35fb5ef7d29019cb19d111cefeb26cb956f72328..ca077f8be1f0a5d11dc189c955c7924307ced1b8 100644 (file)
@@ -1013,7 +1013,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
                err = perf_evsel__parse_sample(evsel, event, &pevent->sample);
 
                /* Consume the even only after we parsed it out. */
-               perf_mmap__consume(md, false);
+               perf_mmap__consume(md);
 
                if (err)
                        return PyErr_Format(PyExc_OSError,