]> Git Repo - linux.git/commitdiff
perf: Suppress AUX/OVERWRITE records
authorAlexander Shishkin <[email protected]>
Wed, 4 Apr 2018 14:53:23 +0000 (17:53 +0300)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 18 Sep 2018 20:21:13 +0000 (17:21 -0300)
It has been pointed out to me many times that it is useful to be able to
switch off AUX records to save the bandwidth for records that actually
matter, for example, in AUX overwrite mode.

The usefulness of PERF_RECORD_AUX is in some of its flags, like the
TRUNCATED flag that tells the decoder where exactly gaps in the trace
are.  The OVERWRITE flag, on the other hand will be set on every single
record in overwrite mode. However, a PERF_RECORD_AUX[flags=OVERWRITE] is
generated on every target task's sched_out, which over time adds up to a
lot of useless information.

If any folks out there have userspace that depends on a constant stream
of OVERWRITE records for a good reason, they'll have to let us know.

Signed-off-by: Alexander Shishkin <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Acked-by: Will Deacon <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Markus T Metzger <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
kernel/events/ring_buffer.c

index 5d3cf407e37469a7b1cafab8c4af303d074bbdf8..4a99370763319dd14d39c7547e4af930779dc38f 100644 (file)
@@ -459,10 +459,20 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
        if (size || handle->aux_flags) {
                /*
                 * Only send RECORD_AUX if we have something useful to communicate
+                *
+                * Note: the OVERWRITE records by themselves are not considered
+                * useful, as they don't communicate any *new* information,
+                * aside from the short-lived offset, that becomes history at
+                * the next event sched-in and therefore isn't useful.
+                * The userspace that needs to copy out AUX data in overwrite
+                * mode should know to use user_page::aux_head for the actual
+                * offset. So, from now on we don't output AUX records that
+                * have *only* OVERWRITE flag set.
                 */
 
-               perf_event_aux_event(handle->event, aux_head, size,
-                                    handle->aux_flags);
+               if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)
+                       perf_event_aux_event(handle->event, aux_head, size,
+                                            handle->aux_flags);
        }
 
        rb->user_page->aux_head = rb->aux_head;
This page took 0.057007 seconds and 4 git commands to generate.