linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	Pekka Paalanen <pq@iki.fi>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Martin Bligh <mbligh@google.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 2/2] ring_buffer: implement new locking
Date: Wed, 1 Oct 2008 08:01:26 +0200	[thread overview]
Message-ID: <20081001060126.GB25703@elte.hu> (raw)
In-Reply-To: <20081001043908.306306212@goodmis.org>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> The old "lock always" scheme had issues with lockdep, and was not very 
> efficient anyways.
> 
> This patch does a new design to be partially lockless on writes. 
> Writes will add new entries to the per cpu pages by simply disabling 
> interrupts. When a write needs to go to another page than it will grab 
> the lock.
> 
> A new "read page" has been added so that the reader can pull out a 
> page from the ring buffer to read without worrying about the writer 
> writing over it. This allows us to not take the lock for all reads. 
> The lock is now only taken when a read needs to go to a new page.
> 
> This is far from lockless, and interrupts still need to be disabled, 
> but it is a step towards a more lockless solution, and it also solves 
> a lot of the issues that were noticed by the first conversion of 
> ftrace to the ring buffers.
> 
> Note: the ring_buffer_{un}lock API has been removed.
> 
> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
> ---
>  include/linux/ring_buffer.h |    3 
>  kernel/trace/ring_buffer.c  |  298 +++++++++++++++++++++++++-------------------
>  kernel/trace/trace.c        |  113 +++++++++++-----
>  3 files changed, 247 insertions(+), 167 deletions(-)

applied to tip/tracing/ring-buffer, thanks Steve!

the simplification factor is significant as well - both in linecount and 
in locking complexity. A robust tracer almost never wants to impose 
heavy locking semantics - a good way to disable/enable it on a per CPU 
basis is more than enough to 'freeze' the trace and get it out to the 
user.

Perhaps, before we free trace buffers, we should do an RCU sync to make 
sure no access can linger? Right now we dont seem to free buffers 
anywhere.

	Ingo

  reply	other threads:[~2008-10-01  6:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01  4:29 [PATCH 0/2] ring_buffer: updates for linux-tip Steven Rostedt
2008-10-01  4:29 ` [PATCH 1/2] ring_buffer: remove raw from local_irq_save Steven Rostedt
2008-10-01  5:52   ` Ingo Molnar
2008-10-01  6:08     ` Ingo Molnar
2008-10-01  6:14       ` Ingo Molnar
2008-10-01  4:29 ` [PATCH 2/2] ring_buffer: implement new locking Steven Rostedt
2008-10-01  6:01   ` Ingo Molnar [this message]
2008-10-01  7:20 ` [PATCH 0/2] ring_buffer: updates for linux-tip Frédéric Weisbecker
2008-10-01  7:23   ` Ingo Molnar
2008-10-01 12:32     ` Frédéric Weisbecker
2008-10-01 17:08       ` Frédéric Weisbecker
2008-10-01 17:14     ` [PATCH] ftrace: preempt disable over interrupt disable Steven Rostedt

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=20081001060126.GB25703@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=peterz@infradead.org \
    --cc=pq@iki.fi \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).