ring-buffer: Updates for 7.3
Linus,
ring-buffer updates for 7.3:
- Remove unneeded semicolon
A macro ended with a semicolon that wasn't needed.
- Fix freeing cpu_buffer extra subbuffer with order greater than zero
When the cpu_buffer was being freed, its "free" page, was using free_page() to free it when it could be more than one page.
- Hold the cpu_buffer lock when resizing the subbuffer
The freeing of the "free" page of the cpu_buffer was done without locking. The order of the data was being saved and then the "free" page was set to NULL. But there is a race that the "free" page could have been updated between those two operations. Add locking around it to prevent the race.
- Save the order of the data along with the data in the free page
The cpu_buffer would store just the data portion of the subbuffer page in its descriptor. But it did not store the order of the data pages. The order was being saved in the global buffer descriptor. But this leads to races.
Have the cpu_buffer save the subbuf data along with its metadata (which includes the order of the page) to make sure when it frees it, it frees the correct order along with it.
- Remove the subbuf_size and use the order directly when needed
Having a size field for the size of the subbufer along with its order allowed for races to have them get out of sync. Remove the subbuf_size and use the order from the subbuf meta data directly under locks.
Use the subbuf_order for other calculations in the ring buffer.
- Remove the useless "cpus" field of trace_buffer
The code has been restructured and the "cpus" field is no longer used. Remove it.
- Remove the "mapped" field of the ring buffer and use a helper function instead.
The "mapped" field has become a bit overused and made the code come complex in using a counter for what is denoted as being mapped or not. There are other fields that are set when the ring buffer is considered mapped. Add a helper function to check those fields and use that instead of keeping track of a counter.
Please pull the latest trace-ringbuffer-v7.3 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-ringbuffer-v7.3
Tag SHA1: ff54701599a2c7d5155e1180ecac245a6a8d40c7 Head SHA1: 8b502bf6eb3da15f4b954ad3632335ff10ed746a
Julia Lawall (1):
ring-buffer: drop unneeded semicolon
Vincent Donnefort (8):
ring-buffer: Free cpu_buffer::free_page with subbuf_order
ring-buffer: Hold cpu_buffer::lock when resizing a subbuf
ring-buffer: Make cpu_buffer::free_page a buffer_data_read_page
ring-buffer: Fix subbuf resize race with ring buffer readers
ring-buffer: Fix subbuf resize race with ring_buffer_alloc_read_page()
ring-buffer: Dynamically calculate max_data_size
ring-buffer: Remove trace_buffer::cpus
ring-buffer: Remove ring_buffer_per_cpu::mapped
----
kernel/trace/ring_buffer.c | 272 ++++++++++++++++++++++++++------------------- 1 file changed, 160 insertions(+), 112 deletions(-)
---------------------------
The pull request you sent on Sat, 15 Aug 2026 15:30:17 -0400:
The pull request you sent on Sat, 15 Aug 2026 15:30:17 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.gittrace-ringbuffer-v7.3
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/cb8a75eec0877810b50aa1c5a833f929525cd2ee
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html