[PATCH v5 0/3] tools/mm/page_owner_sort: fix filtering and cleanup issues

From: Yichong Chen

Date: Sun Jun 28 2026 - 21:44:34 EST


Hi,

Resend the page_owner_sort cleanup series with corrected threading.

This version replaces the single patch currently queued in mm-new by
splitting the cleanup into smaller patches and adding the search_pattern()
bounds fix.

Patch 1 renames is_need() to filter_record() and makes the filter path
return explicit results. Patch 2 fixes the per-record allocation leaks.
Patch 3 bounds search_pattern() output copies, addressing the pre-existing
issue reported by Sashiko/AI review.

Changes in v5:
- Resend the series with corrected threading.
- Keep Ye Liu and Zhen Ni copied, as Andrew requested.
- Add patch 3 to bound search_pattern() output copies.

Changes in v4:
- Split the filter_record() cleanup into a separate patch.
- Mention the is_need() to filter_record() rename in the commit log.
- Add Reviewed-by from Vishal.

Changes in v3:
- Keep the free in add_list(), since incomplete records are not included
in list_size and cannot be reached by the common cleanup path.
- Return explicit error, skip, and match results from filter_record() to
handle a NULL return from get_comm().

Changes in v2:
- Wrap commit message lines to approximately 75 columns.
- Use "Yichong Chen" as the author name.

Yichong Chen (3):
tools/mm/page_owner_sort: return explicit filter results
tools/mm/page_owner_sort: free per-record allocations
tools/mm/page_owner_sort: bound pattern output copies

tools/mm/page_owner_sort.c | 86 ++++++++++++++++++++++++++++++--------
1 file changed, 69 insertions(+), 17 deletions(-)

--
2.51.0