On Thu, 30 Apr 2026 00:15:59 +0900
Masami Hiramatsu (Google) <[email protected]> wrote:
> It should not be a never ending loop (there are other exit conditions),
> but I agreed. What about limiting with nr_subbufs?
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 5326924615a4..aa89ec96e964 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -5630,7 +5630,8 @@ __rb_get_reader_page(struct ring_buffer_per_cpu
> *cpu_buffer)
> * a case where we will loop three times. There should be no
> * reason to loop four times (that I know of).
> */
> - if (RB_WARN_ON(cpu_buffer, ++nr_loops > 3)) {
> + if (RB_WARN_ON(cpu_buffer,
> + ++nr_loops > (cpu_buffer->ring_meta ? cpu_buffer->nr_subbufs :
> 3))) {
> reader = NULL;
> goto out;
> }
Yeah, this looks more reasonable.
Thanks,
-- Steve