On Tue, 01 Apr 2025 17:51:17 -0400
Steven Rostedt <[email protected]> wrote:
> @@ -9615,8 +9619,12 @@ static void free_trace_buffers(struct trace_array *tr)
> free_trace_buffer(&tr->max_buffer);
> #endif
>
> - if (tr->range_addr_start)
> - vunmap((void *)tr->range_addr_start);
> + if (tr->range_addr_start) {
> + void *start = (void *)tr->range_addr_start;
> + void *end = start + tr->range_addr_size;
> +
> + free_reserved_area(start, end, 0, tr->range_name);
> + }
> }
>
> static void init_trace_flags_index(struct trace_array *tr)
Masami,
Note, your patch to free the persistent ring buffer wasn't fully
functional, as it only did the "vunmap()". That doesn't return the buffer
back to the buddy allocator. What you saw was just the freeing of all the
other descriptors that make up a trace instance.
Before this patch:
~# free
total used free shared buff/cache
available
Mem: 8185908 297404 7825896 916 162288
7888504
Swap: 7812092 0 7812092
~# rmdir /sys/kernel/tracing/instances/boot_mapped
~# free
total used free shared buff/cache
available
Mem: 8206384 297956 7845904 916 162260
7908428
Swap: 7812092 0 7812092
Amount freed: 7845904 - 7825896 = 20008 (20M)
After this patch:
~# free
total used free shared buff/cache
available
Mem: 8185912 301808 7820696 920 162860
7884104
Swap: 7812092 0 7812092
~# rmdir /sys/kernel/tracing/instances/boot_mapped
~# free
total used free shared buff/cache
available
Mem: 8226868 295968 7867644 920 162836
7930900
Swap: 7812092 0 7812092
Amount freed: 7867644 - 7820696 = 46948 (46M)!
-- Steve