mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
ring-buffer: Convert ring_buffer_write() to use guard(preempt_notrace)
The function ring_buffer_write() has a goto out to only do a preempt_enable_notrace(). This can be replaced by a guard. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Link: https://lore.kernel.org/20250801203858.205479143@kernel.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
12d5189615
commit
db5f0c3e3e
1 changed files with 6 additions and 10 deletions
|
@ -4714,26 +4714,26 @@ int ring_buffer_write(struct trace_buffer *buffer,
|
|||
int ret = -EBUSY;
|
||||
int cpu;
|
||||
|
||||
preempt_disable_notrace();
|
||||
guard(preempt_notrace)();
|
||||
|
||||
if (atomic_read(&buffer->record_disabled))
|
||||
goto out;
|
||||
return -EBUSY;
|
||||
|
||||
cpu = raw_smp_processor_id();
|
||||
|
||||
if (!cpumask_test_cpu(cpu, buffer->cpumask))
|
||||
goto out;
|
||||
return -EBUSY;
|
||||
|
||||
cpu_buffer = buffer->buffers[cpu];
|
||||
|
||||
if (atomic_read(&cpu_buffer->record_disabled))
|
||||
goto out;
|
||||
return -EBUSY;
|
||||
|
||||
if (length > buffer->max_data_size)
|
||||
goto out;
|
||||
return -EBUSY;
|
||||
|
||||
if (unlikely(trace_recursive_lock(cpu_buffer)))
|
||||
goto out;
|
||||
return -EBUSY;
|
||||
|
||||
event = rb_reserve_next_event(buffer, cpu_buffer, length);
|
||||
if (!event)
|
||||
|
@ -4751,10 +4751,6 @@ int ring_buffer_write(struct trace_buffer *buffer,
|
|||
|
||||
out_unlock:
|
||||
trace_recursive_unlock(cpu_buffer);
|
||||
|
||||
out:
|
||||
preempt_enable_notrace();
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ring_buffer_write);
|
||||
|
|
Loading…
Add table
Reference in a new issue