Re: [PATCH v1 2/2] ring-buffer: Unify ring buffer minimum page calculations

From: Steven Rostedt

Date: Wed Sep 09 2026 - 18:19:02 EST


On Mon, 7 Sep 2026 20:26:43 +0100
Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote:

> The codebase scatters hardcoded minimum page limits across multiple
> places. Introduce RING_BUFFER_MIN_NR_PAGES and rb_size_to_nr_pages() to
> formalize the requirement of two pages in a ring buffer.

Now I read this after I replied to patch 1 :-)

Anyway, I like my calculate_nr_pages() better than rb_size_to_nr_pages()
but I'm not really picky ;-)

I would make the helper function part of the first patch as you introduce
the duplication of the code there. Whenever I introduce a duplicate code, I
will usually do it by creating a helper function and using that function in
the places of the duplication instead of making it into two steps.

The use of the MIN_NR_PAGES macro can stay as a separate patch.

-- Steve