perf/ring-buffer: refactor code of reading the value of data_tail
PATCH 1/1 perf/ring-buffer: refactor code of reading the value of data_tail
The tail variable will only be accessed when overwrite is 0, so we can put the assignment statement in the if branch.
Fixes d1b26c70246b ("perf/ring_buffer: Prepare writing into the ring-buffer from the end")
Signed-off-by Donglin Peng <[email protected]>
--- kernel/events/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/ring_buffer.c +1 -1
@@ -194,8 +194,8 @@ __perf_output_begin(struct perf_output_handle *handle, offset =local_read (&rb->head); do { head = offset; - tail = READ_ONCE(rb->user_page->data_tail); if (!rb->overwrite) { + tail = READ_ONCE(rb->user_page->data_tail); if (unlikely(!ring_buffer_has_space(head, tail, perf_data_size(rb), size, backward)))
Signature · 1 line
2.25.1