[PATCH 0/3] tools/mm/page_owner_sort: fix --sort, add module filter, improve usage

Ye Liu posted 3 patches 2 days, 20 hours ago
Documentation/mm/page_owner.rst |   8 +-
tools/mm/page_owner_sort.c      | 125 +++++++++++++++++++++++++++-----
2 files changed, 113 insertions(+), 20 deletions(-)
[PATCH 0/3] tools/mm/page_owner_sort: fix --sort, add module filter, improve usage
Posted by Ye Liu 2 days, 20 hours ago
From: Ye Liu <liuye@kylinos.cn>

This series improves the page_owner_sort tool with a bug fix, a new
module-name feature, and better usage text.

Patch 1 fixes a long-standing bug where --sort was silently ignored
when used without a short option (-a, -m, -p, etc.).  The COMP_NO_FLAG
case fell through to COMP_NUM and overwrote the sort conditions
configured by parse_sort_args().

Patch 2 adds kernel module name support for sort, cull, and filter
operations.  Page owner stack traces already contain module names in
the [module] format produced by %pS, but page_owner_sort had no way
to use them.  Records without module frames are assigned "vmlinux".

  # Aggregate page usage per module
  ./page_owner_sort input.txt output.txt --cull=mod

  # Filter to records from xfs module only
  ./page_owner_sort input.txt output.txt --module xfs

  # Sort by module name, then by pid descending
  ./page_owner_sort input.txt output.txt --sort=mod,-pid

Patch 3 lists all available sort keys with abbreviations and examples
directly in the --sort help section so users no longer need to read
the source to discover valid keys.

Ye Liu (3):
  tools/mm/page_owner_sort: fix --sort option being silently ignored
  tools/mm/page_owner_sort: add module name sort/cull/filter support
  tools/mm/page_owner_sort: show available sort keys in usage text

 Documentation/mm/page_owner.rst |   8 +-
 tools/mm/page_owner_sort.c      | 125 +++++++++++++++++++++++++++-----
 2 files changed, 113 insertions(+), 20 deletions(-)

-- 
2.25.1
Re: [PATCH 0/3] tools/mm/page_owner_sort: fix --sort, add module filter, improve usage
Posted by Vlastimil Babka (SUSE) 1 day, 14 hours ago
On 7/22/26 04:37, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> This series improves the page_owner_sort tool with a bug fix, a new
> module-name feature, and better usage text.

For some reason, patches 1 and 3 have very limited recipient list compared
to 0 and 2, please fix when sending a v2.

> Patch 1 fixes a long-standing bug where --sort was silently ignored
> when used without a short option (-a, -m, -p, etc.).  The COMP_NO_FLAG
> case fell through to COMP_NUM and overwrote the sort conditions
> configured by parse_sort_args().
> 
> Patch 2 adds kernel module name support for sort, cull, and filter
> operations.  Page owner stack traces already contain module names in
> the [module] format produced by %pS, but page_owner_sort had no way
> to use them.  Records without module frames are assigned "vmlinux".
> 
>   # Aggregate page usage per module
>   ./page_owner_sort input.txt output.txt --cull=mod
> 
>   # Filter to records from xfs module only
>   ./page_owner_sort input.txt output.txt --module xfs
> 
>   # Sort by module name, then by pid descending
>   ./page_owner_sort input.txt output.txt --sort=mod,-pid
> 
> Patch 3 lists all available sort keys with abbreviations and examples
> directly in the --sort help section so users no longer need to read
> the source to discover valid keys.
> 
> Ye Liu (3):
>   tools/mm/page_owner_sort: fix --sort option being silently ignored
>   tools/mm/page_owner_sort: add module name sort/cull/filter support
>   tools/mm/page_owner_sort: show available sort keys in usage text
> 
>  Documentation/mm/page_owner.rst |   8 +-
>  tools/mm/page_owner_sort.c      | 125 +++++++++++++++++++++++++++-----
>  2 files changed, 113 insertions(+), 20 deletions(-)
>
Re: [PATCH 0/3] tools/mm/page_owner_sort: fix --sort, add module filter, improve usage
Posted by Andrew Morton 1 day, 23 hours ago
On Wed, 22 Jul 2026 10:37:23 +0800 Ye Liu <ye.liu@linux.dev> wrote:

> This series improves the page_owner_sort tool with a bug fix, a new
> module-name feature, and better usage text.
> 
> Patch 1 fixes a long-standing bug where --sort was silently ignored
> when used without a short option (-a, -m, -p, etc.).  The COMP_NO_FLAG
> case fell through to COMP_NUM and overwrote the sort conditions
> configured by parse_sort_args().
> 
> Patch 2 adds kernel module name support for sort, cull, and filter
> operations.  Page owner stack traces already contain module names in
> the [module] format produced by %pS, but page_owner_sort had no way
> to use them.  Records without module frames are assigned "vmlinux".
> 
>   # Aggregate page usage per module
>   ./page_owner_sort input.txt output.txt --cull=mod
> 
>   # Filter to records from xfs module only
>   ./page_owner_sort input.txt output.txt --module xfs
> 
>   # Sort by module name, then by pid descending
>   ./page_owner_sort input.txt output.txt --sort=mod,-pid
> 
> Patch 3 lists all available sort keys with abbreviations and examples
> directly in the --sort help section so users no longer need to read
> the source to discover valid keys.

Thanks, these sound like nice changes.

AI review mentioned a couple of things, at least one of which appears legit:
	https://sashiko.dev/#/patchset/20260722023726.600200-1-ye.liu@linux.dev