Re: [PATCH v2] tracing: Allow changing default ring buffer size for ftrace instances.

From: Steven Rostedt
Date: Tue Apr 29 2014 - 18:36:47 EST


On Fri, 14 Feb 2014 15:29:57 -0800
Bharath Ravi <rbharath@xxxxxxxxxx> wrote:

> > @@ -5930,7 +5932,7 @@ static int allocate_trace_buffers(struct trace_array *tr, int size)
> > static int new_instance_create(const char *name)
> > {
> > struct trace_array *tr;
> > - int ret;
> > + int ret, ring_buffer_size;
> >
> > mutex_lock(&trace_types_lock);
> >
> > @@ -5961,7 +5963,12 @@ static int new_instance_create(const char *name)
> > INIT_LIST_HEAD(&tr->systems);
> > INIT_LIST_HEAD(&tr->events);
> >
> > - if (allocate_trace_buffers(tr, trace_buf_size) < 0)
> > + /* allocate memory only if buffers are to be expanded */
> > + if (trace_flags & TRACE_EXPAND_NEW_BUFFERS)
> > + ring_buffer_size = trace_buf_size;
> > + else
> > + ring_buffer_size = 1

Sure you tested this patch?

Well, playing with it, I've come back full circle, and think having the
option is better.

Now, I wonder if we should have the buffers act like the main buffer
when this option is cleared. That is, if you set "expand-new-buffers"
to zero, when you create the buffer, it should be the minimum but will
expand as soon as they will be used to whatever the main buffer was.

Of course you can still set the size before you do so, just like the
main buffer does.

That way the name sounds better. Because when "expand-new-buffers" is
zero, it sounds like they should not be expanded, but can be when used.

How's that sound?

-- Steve



> > + if (allocate_trace_buffers(tr, ring_buffer_size) < 0)
> > goto out_free_tr;
> >
> > tr->dir = debugfs_create_dir(name, trace_instance_dir);
> > diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> > index ea189e0..15ddbf4 100644
> > --- a/kernel/trace/trace.h
> > +++ b/kernel/trace/trace.h
> > @@ -888,6 +888,7 @@ enum trace_iterator_flags {
> > TRACE_ITER_IRQ_INFO = 0x800000,
> > TRACE_ITER_MARKERS = 0x1000000,
> > TRACE_ITER_FUNCTION = 0x2000000,
> > + TRACE_EXPAND_NEW_BUFFERS = 0x4000000,
> > };
> >
> > /*
> > --
> > 1.8.5.3
> >

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/