Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "zhen.ni" <zhen.ni@easystack.cn>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: vbabka@kernel.org, surenb@google.com, mhocko@suse.com,
	jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 3/4] tools/mm: add page_owner_filter userspace tool
Date: Mon, 29 Jun 2026 16:31:48 +0800	[thread overview]
Message-ID: <8762c792-da23-461a-bd19-5976157c18e5@easystack.cn> (raw)
In-Reply-To: <20260624215044.1c50c765a240f50fdf49189a@linux-foundation.org>



在 2026/6/25 12:50, Andrew Morton 写道:
> On Thu, 25 Jun 2026 12:31:00 +0800 Zhen Ni <zhen.ni@easystack.cn> wrote:
> 
>> Add a userspace filtering tool for page_owner that supports per-fd
>> filtering with print_mode and NUMA node filters.
> 
> Could this functionality have been built into page_owner_sort.c, or
> does that not make any sense?
> 
> 
> 
Hi,

I've considered the possibility of merging the two tools. They serve
different purposes:

- page_owner_sort: a post-processing tool for sorting/aggregating
  already-captured page_owner dumps

- page_owner_filter: a real-time filtering tool

They function like two stages in a pipeline. While there may be
opportunities to share some parsing/formatting code between the two
tools in the future, a direct merge doesn't make sense.

I believe that as page_owner_filter's functionality expands,
it could potentially replace most of page_owner_sort's features.

Looking at page_owner_sort's current interface:

Usage: ./page_owner_sort [OPTIONS] <input> <output>
-a                      Sort by memory allocation time.
-m                      Sort by total memory.
-n                      Sort by task command name.
-p                      Sort by pid.
-P                      Sort by tgid.
-s                      Sort by the stacktrace.
-t                      Sort by number of times record is seen (default).

--pid <pidlist>         Select by pid.
--tgid <tgidlist>       Select by tgid.
--name <cmdlist>        Select by command name.
--cull <rules>          Cull by user-defined rules.
--sort <order>          Specify sort order.

For example:
- Sorting by task command name (-n), PID (-p), TGID (-P), or stacktrace
   (-s) seems less useful in practice — users typically care about 
specific processes rather than sorted lists.
- Sorting by total memory (-m) or occurrence count (-t) overlaps with
   /sys/kernel/debug/page_owner_stacks functionality, which is more 
efficient.
- Filtering options (--pid, --tgid, --name, --cull) could potentially be
   implemented in page_owner_filter as well.


Thanks,
Zhen


  reply	other threads:[~2026-06-29  8:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25  4:30 [PATCH v11 0/4] mm/page_owner: add per-fd filter infrastructure for print_mode and NUMA filtering Zhen Ni
2026-06-25  4:30 ` [PATCH v11 1/4] mm/page_owner: add print_mode filter Zhen Ni
2026-06-25 18:26   ` Zi Yan
2026-06-25 19:20     ` Andrew Morton
2026-06-25 19:24       ` Zi Yan
2026-06-29  2:59   ` Ye Liu
2026-06-29  9:30     ` Vlastimil Babka (SUSE)
2026-06-25  4:30 ` [PATCH v11 2/4] mm/page_owner: add NUMA node filter Zhen Ni
2026-06-25 18:37   ` Zi Yan
2026-06-26  8:20     ` zhen.ni
2026-06-25 19:27   ` Zi Yan
2026-06-25 20:04     ` Andrew Morton
2026-06-25  4:31 ` [PATCH v11 3/4] tools/mm: add page_owner_filter userspace tool Zhen Ni
2026-06-25  4:50   ` Andrew Morton
2026-06-29  8:31     ` zhen.ni [this message]
2026-06-25  4:31 ` [PATCH v11 4/4] mm/page_owner: document page_owner filter Zhen Ni
2026-06-25  4:55 ` [PATCH v11 0/4] mm/page_owner: add per-fd filter infrastructure for print_mode and NUMA filtering Andrew Morton
2026-06-25 12:57   ` zhen.ni
2026-06-25 18:22 ` Zi Yan

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=8762c792-da23-461a-bd19-5976157c18e5@easystack.cn \
    --to=zhen.ni@easystack.cn \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.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