mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ring-buffer: Rename ring_buffer_size() to ring_buffer_capacity()
Since commit 8a5f636378 ("ring-buffer: Fix subbuf resize race with
ring buffer readers"), "capacity" refers to the memory available for
events (excluding subbuffer headers) while "size" refers to the raw
allocation. ring_buffer_size() actually calculates this event capacity.
Rename it to ring_buffer_capacity() to align with this convention.
Link: https://patch.msgid.link/20260908090937.838544-2-vdonnefort@google.com
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
084100a1b5
commit
4b0c4fb9bc
|
|
@ -166,7 +166,7 @@ void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
|
|||
int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
|
||||
bool ring_buffer_iter_dropped(struct ring_buffer_iter *iter);
|
||||
|
||||
unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu);
|
||||
unsigned long ring_buffer_capacity(struct trace_buffer *buffer, int cpu);
|
||||
unsigned long ring_buffer_max_event_size(struct trace_buffer *buffer);
|
||||
|
||||
void ring_buffer_reset_cpu(struct trace_buffer *buffer, int cpu);
|
||||
|
|
|
|||
|
|
@ -6546,18 +6546,23 @@ void ring_buffer_iter_advance(struct ring_buffer_iter *iter)
|
|||
EXPORT_SYMBOL_GPL(ring_buffer_iter_advance);
|
||||
|
||||
/**
|
||||
* ring_buffer_size - return the size of the ring buffer (in bytes)
|
||||
* ring_buffer_capacity - return the capacity of the ring buffer (in bytes)
|
||||
* @buffer: The ring buffer.
|
||||
* @cpu: The CPU to get ring buffer size from.
|
||||
* @cpu: The CPU to get ring buffer capacity from.
|
||||
*
|
||||
* Capacity is the total memory available for recording event data in the
|
||||
* ring buffer. It excludes subbuffer headers.
|
||||
*
|
||||
* Returns the capacity in bytes, or 0 if the CPU is not set in the buffer mask.
|
||||
*/
|
||||
unsigned long ring_buffer_size(struct trace_buffer *buffer, int cpu)
|
||||
unsigned long ring_buffer_capacity(struct trace_buffer *buffer, int cpu)
|
||||
{
|
||||
if (!cpumask_test_cpu(cpu, buffer->cpumask))
|
||||
return 0;
|
||||
|
||||
return rb_subbuf_capacity(buffer) * buffer->buffers[cpu]->nr_pages;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ring_buffer_size);
|
||||
EXPORT_SYMBOL_GPL(ring_buffer_capacity);
|
||||
|
||||
/**
|
||||
* ring_buffer_max_event_size - return the max data size of an event
|
||||
|
|
|
|||
|
|
@ -4712,9 +4712,9 @@ void trace_set_buffer_entries(struct array_buffer *buf, unsigned long val)
|
|||
static void update_buffer_entries(struct array_buffer *buf, int cpu)
|
||||
{
|
||||
if (cpu == RING_BUFFER_ALL_CPUS) {
|
||||
trace_set_buffer_entries(buf, ring_buffer_size(buf->buffer, 0));
|
||||
trace_set_buffer_entries(buf, ring_buffer_capacity(buf->buffer, 0));
|
||||
} else {
|
||||
per_cpu_ptr(buf->data, cpu)->entries = ring_buffer_size(buf->buffer, cpu);
|
||||
per_cpu_ptr(buf->data, cpu)->entries = ring_buffer_capacity(buf->buffer, cpu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8520,7 +8520,7 @@ int allocate_trace_buffer(struct trace_array *tr, struct array_buffer *buf, int
|
|||
|
||||
/* Allocate the first page for all buffers */
|
||||
trace_set_buffer_entries(&tr->array_buffer,
|
||||
ring_buffer_size(tr->array_buffer.buffer, 0));
|
||||
ring_buffer_capacity(tr->array_buffer.buffer, 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user