[PATCH v18 4/8] ring-buffer: Skip invalid sub-buffers when rewinding persistent ring buffer
Steven Rostedt
rostedt at goodmis.org
Wed Apr 29 09:39:26 PDT 2026
On Thu, 30 Apr 2026 00:20:23 +0900
Masami Hiramatsu (Google) <mhiramat at kernel.org> wrote:
> On Tue, 28 Apr 2026 16:21:46 -0400
> Steven Rostedt <rostedt at goodmis.org> wrote:
>
> > On Fri, 24 Apr 2026 15:52:35 +0900
> > "Masami Hiramatsu (Google)" <mhiramat at kernel.org> wrote:
> >
> > > @@ -1892,9 +1895,19 @@ static int rb_validate_buffer(struct buffer_data_page *dpage, int cpu,
> > > * subbuf_size is considered invalid.
> > > */
> > > tail = local_read(&dpage->commit) & ~RB_MISSED_MASK;
> > > - if (tail > meta->subbuf_size - BUF_PAGE_HDR_SIZE)
> > > - return -1;
> > > - return rb_read_data_buffer(dpage, tail, cpu, &ts, &delta);
> > > + if (tail <= meta->subbuf_size - BUF_PAGE_HDR_SIZE)
> > > + ret = rb_read_data_buffer(dpage, tail, cpu, &ts, &delta);
> > > +
> >
> > This code seriously needs comments.
>
> OK, I'll add it, or let code explain clearer?
>
> if (tail <= meta->subbuf_size - BUF_PAGE_HDR_SIZE)
> ret = rb_read_data_buffer(dpage, tail, cpu, &ts, &delta);
> else
> ret = -1;
That's better...
>
> Thanks,
>
The below should have some explanation too. I can figure it out, but it
wasted more brain cycles than I would have liked ;-)
-- Steve
> >
> > > + if (ret < 0 || (prev_ts && prev_ts > ts) || (next_ts && ts > next_ts)) {
> > > + local_set(&bpage->entries, 0);
> > > + local_set(&bpage->page->commit, 0);
> > > + bpage->page->time_stamp = prev_ts ? prev_ts : next_ts;
> > > + ret = -1;
> > > + } else {
> > > + local_set(&bpage->entries, ret);
> > > + }
> > > +
> > > + return ret;
> > > }
> > >
>
>
More information about the linux-arm-kernel
mailing list