Re: [PATCH v2 2/3] tools/mm/page_owner_sort: add module name sort/cull/filter support

"David Hildenbrand (Arm)" <[email protected]> Mon, 3 Aug 2026 10:23:28 +0200
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On 8/3/26 08:20, Ye Liu wrote:
> From: Ye Liu <[email protected]>
> 
> 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 <[email protected]>
> ---

Nothing jumped at me when skimming over it.

-- 
Cheers,

David