Skip to content

Commit f0d8cbc

Browse files
committed
ring-buffer: Simplify reset_disabled_cpu_buffer() with use of guard()
Use guard(raw_spinlock_irqsave)() in reset_disabled_cpu_buffer() to simplify the locking. Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/20250527144623.77a9cc47@gandalf.local.home Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent f115d2b commit f0d8cbc

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

kernel/trace/ring_buffer.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6113,21 +6113,16 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
61136113
/* Must have disabled the cpu buffer then done a synchronize_rcu */
61146114
static void reset_disabled_cpu_buffer(struct ring_buffer_per_cpu *cpu_buffer)
61156115
{
6116-
unsigned long flags;
6117-
6118-
raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
6116+
guard(raw_spinlock_irqsave)(&cpu_buffer->reader_lock);
61196117

61206118
if (RB_WARN_ON(cpu_buffer, local_read(&cpu_buffer->committing)))
6121-
goto out;
6119+
return;
61226120

61236121
arch_spin_lock(&cpu_buffer->lock);
61246122

61256123
rb_reset_cpu(cpu_buffer);
61266124

61276125
arch_spin_unlock(&cpu_buffer->lock);
6128-
6129-
out:
6130-
raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
61316126
}
61326127

61336128
/**

0 commit comments

Comments
 (0)