From: Andrew Morton <akpm@linux-foundation.org>
To: Yichong Chen <chenyichong@uniontech.com>
Cc: vishal.moola@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v3] tools/mm/page_owner_sort: free per-record allocations
Date: Thu, 25 Jun 2026 17:19:39 -0700 [thread overview]
Message-ID: <20260625171939.6b920a87159a1cc695ec4de2@linux-foundation.org> (raw)
In-Reply-To: <610C3A89A09303F8+20260612055017.632263-1-chenyichong@uniontech.com>
On Fri, 12 Jun 2026 13:50:17 +0800 Yichong Chen <chenyichong@uniontech.com> wrote:
>
(how come so may people are working on page_owner lately?)
>
> add_list() allocates comm and txt for each page owner record, but the
> cleanup path only frees the outer list array. This leaks both buffers for
> every retained record.
>
> Free partial allocations in add_list(), discarded records during
> culling, and retained records on exit. Return explicit error, skip, and
> match results from filter_record() to handle get_comm() failures.
Well gee, there's a very reliable way of freeing all the allocated
memory and there's a syscall for the purpose - exit()!
Really, everything below the "out_free:" label in main() can just be
deleted.
But oh well, the code does make an attempt to clean up after itself so
I guess we should set a good example. Thanks.
btw, AI review flagged another (pre-existing) issue which we normally
wouldn't care about:
https://sashiko.dev/#/patchset/610C3A89A09303F8+20260612055017.632263-1-chenyichong@uniontech.com
prev parent reply other threads:[~2026-06-26 0:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 5:50 Yichong Chen
2026-06-15 12:24 ` Vishal Moola
2026-06-26 0:19 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625171939.6b920a87159a1cc695ec4de2@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=chenyichong@uniontech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vishal.moola@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®