Skip to content

Commit 761d947

Browse files
committed
ring-buffer: Do not set shortest_full when full target is hit
The rb_watermark_hit() checks if the amount of data in the ring buffer is above the percentage level passed in by the "full" variable. If it is, it returns true. But it also sets the "shortest_full" field of the cpu_buffer that informs writers that it needs to call the irq_work if the amount of data on the ring buffer is above the requested amount. The rb_watermark_hit() always sets the shortest_full even if the amount in the ring buffer is what it wants. As it is not going to wait, because it has what it wants, there's no reason to set shortest_full. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: [email protected] Cc: Mathieu Desnoyers <[email protected]> Fixes: 42fb0a1 ("tracing/ring-buffer: Have polling block on watermark") Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent e5d7c19 commit 761d947

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kernel/trace/ring_buffer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,9 +834,10 @@ static bool rb_watermark_hit(struct trace_buffer *buffer, int cpu, int full)
834834
pagebusy = cpu_buffer->reader_page == cpu_buffer->commit_page;
835835
ret = !pagebusy && full_hit(buffer, cpu, full);
836836

837-
if (!cpu_buffer->shortest_full ||
838-
cpu_buffer->shortest_full > full)
839-
cpu_buffer->shortest_full = full;
837+
if (!ret && (!cpu_buffer->shortest_full ||
838+
cpu_buffer->shortest_full > full)) {
839+
cpu_buffer->shortest_full = full;
840+
}
840841
raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
841842
}
842843
return ret;

0 commit comments

Comments
 (0)