Skip to content

Commit d06aff1

Browse files
committed
tracing: Update snapshot buffer on resize if it is allocated
The snapshot buffer is to mimic the main buffer so that when a snapshot is needed, the snapshot and main buffer are swapped. When the snapshot buffer is allocated, it is set to the minimal size that the ring buffer may be at and still functional. When it is allocated it becomes the same size as the main ring buffer, and when the main ring buffer changes in size, it should do. Currently, the resize only updates the snapshot buffer if it's used by the current tracer (ie. the preemptirqsoff tracer). But it needs to be updated anytime it is allocated. When changing the size of the main buffer, instead of looking to see if the current tracer is utilizing the snapshot buffer, just check if it is allocated to know if it should be updated or not. Also fix typo in comment just above the code change. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: [email protected] Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Fixes: ad909e2 ("tracing: Add internal tracing_snapshot() functions") Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 17d8017 commit d06aff1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6348,15 +6348,15 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr,
63486348
if (!tr->array_buffer.buffer)
63496349
return 0;
63506350

6351-
/* Do not allow tracing while resizng ring buffer */
6351+
/* Do not allow tracing while resizing ring buffer */
63526352
tracing_stop_tr(tr);
63536353

63546354
ret = ring_buffer_resize(tr->array_buffer.buffer, size, cpu);
63556355
if (ret < 0)
63566356
goto out_start;
63576357

63586358
#ifdef CONFIG_TRACER_MAX_TRACE
6359-
if (!tr->current_trace->use_max_tr)
6359+
if (!tr->allocated_snapshot)
63606360
goto out;
63616361

63626362
ret = ring_buffer_resize(tr->max_buffer.buffer, size, cpu);

0 commit comments

Comments
 (0)