Re: [PATCH 2/2] ring-buffer: Fix a race between readers and resize checks
From: Steven Rostedt
Date: Mon Jun 10 2024 - 11:57:16 EST
On Fri, 7 Jun 2024 10:29:03 +0200
Petr Pavlu <petr.pavlu@xxxxxxxx> wrote:
> Another option could be to try traversing the whole list in smaller
> parts and give up the reader_lock in between them. This would need some
> care to make sure that the operation completes, e.g. the code would need
> to bail out if it detects a change on cpu_buffer->pages_read.
I think I like this approach the most. Perhaps even have a counter that
gets incremented everything a new reader page is taken. And if it
detects that, it restarts the check?
To prevent a DOS, we restart 3 times at most, and then just say "the
list is OK" and exit.
So basically, we release the lock within the loop per each sub-buffer,
and then check if the reader touch it when reacquiring the lock.
-- Steve