[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231220232619.67f0b175578d14f9341fb30c@kernel.org>
Date: Wed, 20 Dec 2023 23:26:19 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Masami
Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, Tzvetomir Stoyanov <tz.stoyanov@...il.com>,
Vincent Donnefort <vdonnefort@...gle.com>, Kent Overstreet
<kent.overstreet@...il.com>
Subject: Re: [PATCH v5 03/15] ring-buffer: Add interface for configuring
trace sub buffer size
On Tue, 19 Dec 2023 13:54:17 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> +/**
> + * ring_buffer_subbuf_order_set - set the size of ring buffer sub page.
> + * @buffer: The ring_buffer to set the new page size.
> + * @order: Order of the system pages in one sub buffer page
> + *
> + * By default, one ring buffer pages equals to one system page. This API can be
> + * used to set new size of the ring buffer page. The size must be order of
> + * system page size, that's why the input parameter @order is the order of
> + * system pages that are allocated for one ring buffer page:
> + * 0 - 1 system page
> + * 1 - 2 system pages
> + * 3 - 4 system pages
> + * ...
Don't we have the max order of the pages?
> + *
> + * Returns 0 on success or < 0 in case of an error.
> + */
> +int ring_buffer_subbuf_order_set(struct trace_buffer *buffer, int order)
> +{
> + int psize;
> +
> + if (!buffer || order < 0)
> + return -EINVAL;
> +
> + if (buffer->subbuf_order == order)
> + return 0;
> +
> + psize = (1 << order) * PAGE_SIZE;
> + if (psize <= BUF_PAGE_HDR_SIZE)
> + return -EINVAL;
> +
> + buffer->subbuf_order = order;
> + buffer->subbuf_size = psize - BUF_PAGE_HDR_SIZE;
> +
> + /* Todo: reset the buffer with the new page size */
> +
I just wonder why there is no reallocate the sub buffers here.
Is it OK to change the sub buffer page size and order while
using the ring buffer?
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists