Skip to content

Commit 2cf9733

Browse files
committed
ring-buffer: Fix refcount setting of boot mapped buffers
A ring buffer which has its buffered mapped at boot up to fixed memory should not be freed. Other buffers can be. The ref counting setup was wrong for both. It made the not mapped buffers ref count have zero, and the boot mapped buffer a ref count of 1. But an normally allocated buffer should be 1, where it can be removed. Keep the ref count of a normal boot buffer with its setup ref count (do not decrement it), and increment the fixed memory boot mapped buffer's ref count. Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: e645535 ("tracing: Add option to use memmapped memory for trace boot instance") Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 912da2c commit 2cf9733

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/trace/trace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10621,10 +10621,10 @@ __init static void enable_instances(void)
1062110621
* cannot be deleted by user space, so keep the reference
1062210622
* to it.
1062310623
*/
10624-
if (start)
10624+
if (start) {
1062510625
tr->flags |= TRACE_ARRAY_FL_BOOT;
10626-
else
10627-
trace_array_put(tr);
10626+
tr->ref++;
10627+
}
1062810628

1062910629
while ((tok = strsep(&curr_str, ","))) {
1063010630
early_enable_events(tr, tok, true);

0 commit comments

Comments
 (0)