mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, Michael Rubin <mrubin@google.com>,
	David Sharp <dhsharp@google.com>
Subject: Re: [PATCH] trace: Add a free on close control mechanism for buffer_size_kb
Date: Wed, 25 May 2011 23:29:51 -0400	[thread overview]
Message-ID: <1306380591.1465.140.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1304118968-6620-1-git-send-email-vnagarnaik@google.com>

On Fri, 2011-04-29 at 16:16 -0700, Vaibhav Nagarnaik wrote:

> +static ssize_t tracing_resize_ring_buffer(unsigned long size)
> +{
> +	int cpu, ret = 0;
> +
> +	mutex_lock(&trace_types_lock);
> +
> +	tracing_stop();
> +
> +	/* disable all cpu buffers */
> +	for_each_tracing_cpu(cpu) {
> +		if (global_trace.data[cpu])
> +			atomic_inc(&global_trace.data[cpu]->disabled);
> +		if (max_tr.data[cpu])
> +			atomic_inc(&max_tr.data[cpu]->disabled);
> +	}
> +
> +	if (size != global_trace.entries)
> +		ret = __tracing_resize_ring_buffer(size);
> +
> +	/* If check pages failed, return ENOMEM */
> +	if (tracing_disabled)
> +		ret = -ENOMEM;

This is incorrect. tracing_disabled is set from
__tracing_resize_ring_buffer() if the max buffer can't become the same
size as the global buffer.

What you should do is just check if ret is less than zero here.

	if (ret < 0)
		ret = -ENOMEM;

-- Steve


> +
> +	for_each_tracing_cpu(cpu) {
> +		if (global_trace.data[cpu])
> +			atomic_dec(&global_trace.data[cpu]->disabled);
> +		if (max_tr.data[cpu])
> +			atomic_dec(&max_tr.data[cpu]->disabled);
> +	}
> +
> +	tracing_start();
> +	mutex_unlock(&trace_types_lock);
> +
> +	return ret;
> +}
> +
>  


  parent reply	other threads:[~2011-05-26  3:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 22:46 Vaibhav Nagarnaik
2011-04-28 23:14 ` Vaibhav Nagarnaik
2011-04-28 23:32 ` Steven Rostedt
2011-04-29 19:45   ` Vaibhav Nagarnaik
2011-04-29 20:01     ` Steven Rostedt
2011-04-29 23:15       ` Vaibhav Nagarnaik
2011-04-29 19:45 ` Vaibhav Nagarnaik
2011-04-29 23:16   ` Vaibhav Nagarnaik
2011-05-24 18:37     ` Vaibhav Nagarnaik
2011-05-24 18:48       ` Steven Rostedt
2011-05-26  3:29     ` Steven Rostedt [this message]
2011-05-26 18:00       ` Vaibhav Nagarnaik
2011-05-26 18:23         ` Steven Rostedt
2011-05-26 18:33           ` Vaibhav Nagarnaik
2011-05-26 18:16     ` [PATCH v2] " Vaibhav Nagarnaik
2011-05-26 18:34       ` Vaibhav Nagarnaik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306380591.1465.140.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=dhsharp@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mrubin@google.com \
    --cc=vnagarnaik@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®