Re: [PATCH v2 2/2] ring-buffer: Reuse rb_watermark_hit() for the poll logic

From: Steven Rostedt
Date: Tue Mar 12 2024 - 11:46:04 EST


On Wed, 13 Mar 2024 00:38:42 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:

> On Tue, 12 Mar 2024 09:19:21 -0400
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
> >
> > The check for knowing if the poll should wait or not is basically the
> > exact same logic as rb_watermark_hit(). The only difference is that
> > rb_watermark_hit() also handles the !full case. But for the full case, the
> > logic is the same. Just call that instead of duplicating the code in
> > ring_buffer_poll_wait().
> >
>
> This changes a bit (e.g. adding pagebusy check) but basically that should
> be there. And new version appears to be consistent between ring_buffer_wait()
> and ring_buffer_poll_wait(). So looks good to me.

The pagebusy check is an optimization. As if it is true, it means the
writer is still on the reader_page and there's no sub-buffers available. It
just prevents having to do the calculation of the buffer-percentage filled
(what's done by the full_hit() logic).

>
> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
>

Thanks!

-- Steve