Skip to content

Commit 1627314

Browse files
virtuosoacmel
authored andcommitted
perf: Suppress AUX/OVERWRITE records
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 <alexander.shishkin@linux.intel.com> Acked-by: Ingo Molnar <mingo@kernel.org> Acked-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Will Deacon <will.deacon@arm.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Markus T Metzger <markus.t.metzger@intel.com> Link: http://lkml.kernel.org/r/20180404145323.28651-1-alexander.shishkin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 7f16023 commit 1627314

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎kernel/events/ring_buffer.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,20 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
459459
if (size || handle->aux_flags) {
460460
/*
461461
* Only send RECORD_AUX if we have something useful to communicate
462+
*
463+
* Note: the OVERWRITE records by themselves are not considered
464+
* useful, as they don't communicate any *new* information,
465+
* aside from the short-lived offset, that becomes history at
466+
* the next event sched-in and therefore isn't useful.
467+
* The userspace that needs to copy out AUX data in overwrite
468+
* mode should know to use user_page::aux_head for the actual
469+
* offset. So, from now on we don't output AUX records that
470+
* have *only* OVERWRITE flag set.
462471
*/
463472

464-
perf_event_aux_event(handle->event, aux_head, size,
465-
handle->aux_flags);
473+
if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)
474+
perf_event_aux_event(handle->event, aux_head, size,
475+
handle->aux_flags);
466476
}
467477

468478
rb->user_page->aux_head = rb->aux_head;

0 commit comments

Comments
 (0)