diff options
author | Steven Rostedt (Google) <[email protected]> | 2024-03-08 15:24:04 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <[email protected]> | 2024-03-10 12:27:40 -0400 |
commit | 68282dd930ea38b068ce2c109d12405f40df3f93 (patch) | |
tree | b1b2ba1f48c0f4aed75af5f7cd2ee4465e4e4e10 /kernel/entry/common.c | |
parent | b3594573681b53316ec0365332681a30463edfd6 (diff) |
ring-buffer: Fix resetting of shortest_full
The "shortest_full" variable is used to keep track of the waiter that is
waiting for the smallest amount on the ring buffer before being woken up.
When a tasks waits on the ring buffer, it passes in a "full" value that is
a percentage. 0 means wake up on any data. 1-100 means wake up from 1% to
100% full buffer.
As all waiters are on the same wait queue, the wake up happens for the
waiter with the smallest percentage.
The problem is that the smallest_full on the cpu_buffer that stores the
smallest amount doesn't get reset when all the waiters are woken up. It
does get reset when the ring buffer is reset (echo > /sys/kernel/tracing/trace).
This means that tasks may be woken up more often then when they want to
be. Instead, have the shortest_full field get reset just before waking up
all the tasks. If the tasks wait again, they will update the shortest_full
before sleeping.
Also add locking around setting of shortest_full in the poll logic, and
change "work" to "rbwork" to match the variable name for rb_irq_work
structures that are used in other places.
Link: https://lore.kernel.org/linux-trace-kernel/[email protected]
Cc: [email protected]
Cc: Masami Hiramatsu <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: linke li <[email protected]>
Cc: Rabin Vincent <[email protected]>
Fixes: 2c2b0a78b3739 ("ring-buffer: Add percentage of ring buffer full to wake up reader")
Signed-off-by: Steven Rostedt (Google) <[email protected]>
Diffstat (limited to 'kernel/entry/common.c')
0 files changed, 0 insertions, 0 deletions