LWN.net Logo

Add dynamic updates to trace ring buffer

From:  Vaibhav Nagarnaik <vnagarnaik@google.com>
To:  Steven Rostedt <rostedt@goodmis.org>, Frederic Weisbecker <fweisbec@gmail.com>, Ingo Molnar <mingo@redhat.com>
Subject:  [PATCH 0/5] Add dynamic updates to trace ring buffer
Date:  Tue, 26 Jul 2011 15:59:49 -0700
Message-ID:  <1311721194-12164-1-git-send-email-vnagarnaik@google.com>
Cc:  Michael Rubin <mrubin@google.com>, David Sharp <dhsharp@google.com>, linux-kernel@vger.kernel.org, Vaibhav Nagarnaik <vnagarnaik@google.com>
Archive-link:  Article, Thread

These patches are in response to the fact that sometimes there are
higher rate of events generated on some CPUs as compared to others. This
makes it inefficient to have equal memory size allocated to each of the
per-cpu ring buffers.

This patch series adds 3 things to achieve this:
* Add a way to measure the rate of events generated on a CPU. This is a
  part of patch#2 which makes the 'stats' files print out the number of
  bytes in the ring buffer, the oldest time stamp ("head ts"), and the
  current time stamp ("now ts"). The rate is measured as: bytes /
  (now-head)

* The next patch#3 adds the flexibility to assign different sizes to
  individual per-cpu ring buffers. This is done by adding a
  "buffer_size_kb" debugfs file entry under per_cpu/* directories.

* The final two patches provide a way to change the size of ring
  buffer concurrent to events being added to the ring buffer. Patch#4
  adds functionality to remove pages from the ring buffer and patch#5
  adds functionality to add pages to the ring buffer.

Patch#1 adds a debugfs entry "buffer_total_size_kb" which provides the
total memory allocated for the ring buffer.

This makes it easy for a user process to monitor the rate at which the
ring buffers are being filled up and update the individual per-cpu ring
buffer sizes in response to it.

Vaibhav Nagarnaik (5):
  trace: Add a new readonly entry to report total buffer size
  trace: Add ring buffer stats to measure rate of events
  trace: Add per_cpu ring buffer control files
  trace: Make removal of ring buffer pages atomic
  trace: Make addition of pages in ring buffer atomic

 include/linux/ring_buffer.h |    8 +-
 kernel/trace/ring_buffer.c  |  562 +++++++++++++++++++++++++++++++------------
 kernel/trace/trace.c        |  241 ++++++++++++++----
 kernel/trace/trace.h        |    2 +-
 4 files changed, 603 insertions(+), 210 deletions(-)

-- 
1.7.3.1

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

Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds