On Mon, Aug 10, 2026 at 05:31:37PM +0900, Masami Hiramatsu wrote: > On Fri, 7 Aug 2026 15:26:41 -0400 > Steven Rostedt <[email protected]> wrote: > > > On Fri, 7 Aug 2026 16:45:23 +0100 > > Vincent Donnefort <[email protected]> wrote: > > > > > free_reserved_page() would do actually. But then it is definitive. > > > > It's not always a reserved page. > > > > > > > > Happy to implement something like that. That also means that the instance > > > can be > > > actually freed? > > > > They can be freed now. Try a rmdir on one.
I meant free_buffer_page() skips the memory for the persistent buffer. > > > > Note implementing this is not straight forward. What I would suggest is Yeah, I started looking at it and quickly understood :) > > that because the persistent ring buffers are contiguous, to resize, you > > basically need to remap to the new size. That means each of the buffers > > will still be attached to each other. > > > > What would need to be done is: > > > > 1. calculate the new size needed to accommodate all the CPU buffers. > > 2. Split them up within the new size region. > > 3. Then free the remaining pages. > > > > Obviously, access to the buffer from readers and writers will need to be > > prohibited while this is happening. That would mean losing all the data on the buffer? Actually the trace_remote needs to teardown the whole buffer before the size is modified. Perhaps if something similar is done for the persistent buffer, trace_remote could benefit. > > Hmm, I think we also need to record the size of persistent ring buffer at > initialization. The buffer size (number of pages are calculated by the > size of reserved memory, which is defined in the kernel cmdline. Could we store in ring_buffer_cpu_meta::buffers that the page is gone and must be skipped to re-create the ring-buffer? > > So if we have `reserve_mem=12M:4096:trace trace_instance=boot_map@trace` on > the kernel cmdline, and we write the buffer_size = 1024(KB) on 2CPU machine, > it can be shrinked down to ~2MB on the reserved memory. However, when we > reboot the machine, the kernel calculates the size as 12MB again, and may > get a validation failure. > > So we also need to add nr_pages and nr_cpus (maybe) on ring_buffer_meta and > calculate the ring buffer size from it, instead of using the reserved memory > size (we also need to check the calculated size is smaller than that.) > > Thank you, > > -- > Masami Hiramatsu (Google) <[email protected]> -- Vincent
