[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231220094030.5d13438b@gandalf.local.home>
Date: Wed, 20 Dec 2023 09:40:30 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.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 Wed, 20 Dec 2023 23:26:19 +0900
Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> 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?
Actually there is. I think it's 7?
Honestly, anything over 5 is probably too much. But hey.
>
> > + *
> > + * 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?
Currently we disable the ring buffer to do the update.
-- Steve
Powered by blists - more mailing lists