[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250401184008.77ca9599@gandalf.local.home>
Date: Tue, 1 Apr 2025 18:40:08 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Linus
Torvalds <torvalds@...ux-foundation.org>, Mark Rutland
<mark.rutland@....com>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Andrew Morton <akpm@...ux-foundation.org>, Vincent Donnefort
<vdonnefort@...gle.com>, Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport
<rppt@...nel.org>, Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH v4 2/4] tracing: Have reserve_mem use phys_to_virt() and
separate from memmap buffer
On Tue, 1 Apr 2025 18:16:40 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> 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)!
Bah! My patch is buggy. Yeah, your code released the memory properly, as you had:
reserve_mem_release_by_name()
which does do free_reserve_area() on the memory mapping.
Which means this patch is buggy and freed the same memory twice.
OK, time for v5 to fix that :-p
-- Steve
Powered by blists - more mailing lists