Re: [PATCH v2 2/3] tools/mm/page_owner_sort: add module name sort/cull/filter support
From: David Hildenbrand (Arm)
Date: Mon Aug 03 2026 - 04:24:44 EST
On 8/3/26 08:20, Ye Liu wrote:
> From: Ye Liu <liuye@xxxxxxxxxx>
>
> Page owner stack traces already contain kernel module names in the
> "function+0xNN/0xNN [module]" format produced by %pS, but page_owner_sort
> has no way to sort, cull, or filter by module.
>
> Extract the first module name from each record's stack trace using an
> anchored regex that matches the stack trace frame format
> "+0x[0-9a-f]+/0x[0-9a-f]+\\s*\\[([a-zA-Z0-9_-]+)\\]".
>
> The regex is anchored to the stack trace frame to avoid false matches on
> kernel thread comm names such as [khugepaged] that appear in the record
> header. The character class includes '-' so modules with hyphens
> (e.g. aa-bb-cc) are correctly matched.
>
> Records whose stack traces contain no module frames are assigned "vmlinux".
>
> New options:
> -M Sort by module name
> --sort=mod Sort by module name (supports +/- prefix)
> --cull=mod Cull (aggregate) by module name
> --module <modlist> Filter to records matching the given module(s)
>
> The module field is also printed in cull output when relevant.
>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
> ---
Nothing jumped at me when skimming over it.
--
Cheers,
David