]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ring-buffer: Show commit numbers in buffer_meta file
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 22 May 2026 17:09:01 +0000 (13:09 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 29 May 2026 02:40:52 +0000 (22:40 -0400)
In addition to the index number, show the commit numbers of
each data page in the per_cpu buffer_meta file.
This is useful for understanding the current status of the
persistent ring buffer. (Note that this file is shown
only for persistent ring buffer and its backup instance)

Link: https://patch.msgid.link/20260522171051.424411323@kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ring_buffer.c

index dc603d9c94148e6f8a165de6a5788006253c412f..88e613e78632fdfe5792578d808890a245061f43 100644 (file)
@@ -2231,6 +2231,7 @@ static int rbm_show(struct seq_file *m, void *v)
        struct ring_buffer_per_cpu *cpu_buffer = m->private;
        struct ring_buffer_cpu_meta *meta = cpu_buffer->ring_meta;
        unsigned long val = (unsigned long)v;
+       struct buffer_data_page *dpage;
 
        if (val == 1) {
                seq_printf(m, "head_buffer:   %d\n",
@@ -2243,7 +2244,9 @@ static int rbm_show(struct seq_file *m, void *v)
        }
 
        val -= 2;
-       seq_printf(m, "buffer[%ld]:    %d\n", val, meta->buffers[val]);
+       dpage = rb_range_buffer(cpu_buffer, val);
+       seq_printf(m, "buffer[%ld]:    %d (commit: %ld)\n",
+                  val, meta->buffers[val], dpage ? local_read(&dpage->commit) : -1);
 
        return 0;
 }