From: Zi Yan <ziy@nvidia.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
"zhen.ni" <zhen.ni@easystack.cn>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R . Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Brendan Jackman <brendan.jackman@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/8] mm/page_owner: Add PID/TGID/COMM and cgroup filtering
Date: Wed, 09 Sep 2026 11:54:51 -0400 [thread overview]
Message-ID: <22D1EC4B-FBCB-421E-B8DA-345B5F3505FB@nvidia.com> (raw)
In-Reply-To: <b8e23456-00af-4097-a769-210a087d2b90@kernel.org>
On 9 Sep 2026, at 6:28, David Hildenbrand (Arm) wrote:
> On 9/9/26 04:35, zhen.ni wrote:
>>
>>
>> 在 2026/9/8 22:30, David Hildenbrand (Arm) 写道:
>>> On 9/7/26 10:26, Zhen Ni wrote:
>>>> This patch series adds process and memory cgroup filtering support to
>>>> page_owner. Following the previous series that introduced print_mode and
>>>> NUMA node filters:
>>>> https://lore.kernel.org/linux-mm/20260707115411.1714314-1-
>>>> zhen.ni@easystack.cn/
>>>>
>>>> This series adds filtering capabilities to page_owner, allowing users to
>>>> filter output by specific processes and memory cgroups. Users can now
>>>> filter page_owner output by PID, TGID, COMM (with wildcard support), and
>>>> memory cgroup path. This makes page_owner debugging more focused and
>>>> efficient for tracking memory allocations in specific contexts.
>>>>
>>>> Targeted filtering provides significant performance benefits on large memory
>>>> servers by reducing both execution time and output size. By filtering at the
>>>> kernel level before reading, only relevant page allocations are processed,
>>>> dramatically reducing the amount of data that needs to be handled in userspace.
>>>
>>> page_owner is used for debugging. Why do we have to add kernel code to make it
>>> faster?
>>>
>>> How much faster are we talking about?
>>
>> On my VM with just 2GB of RAM, the raw page_owner output takes real
>> 0m6.178s. Filter it down to PID 1, and it drops to real 0m0.286s. Handle
>> mode takes real 0m0.938s — roughly an 85% speedup. I've also tried this
>> on a 1TB server, and it's very slow. The numbers would look even more
>> extreme.
>>
>> You're right that execution time isn't the main concern for a debug
>> tool. But that's kind of the point — I'm trying to optimize the current
>> execution flow of page_owner, reduce unnecessary overhead, and make the
>> tool more user-friendly (especially for servers with 1TB+ of memory).If
>> the user only cares about a specific slice of memory, why dump
>> everything from the kernel side and then filter it all over again in
>> userspace? Might as well filter at the source.
>
> Because it results in less kernel code :)
>
> And less kernel code is good. Unless unavoidable.
An alternative is to add BPF hooks like bpf_iter to do the filtering
and by default, when no BPF program is attached, everything is printed.
Best Regards,
Yan, Zi
prev parent reply other threads:[~2026-09-09 15:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 8:26 [PATCH v3 0/8] mm/page_owner: Add PID/TGID/COMM and cgroup filtering Zhen Ni
2026-09-07 8:26 ` [PATCH v3 1/8] mm/page_owner: Add PID filtering support Zhen Ni
2026-09-07 8:26 ` [PATCH v3 2/8] mm/page_owner: Add TGID " Zhen Ni
2026-09-07 8:26 ` [PATCH v3 3/8] mm/page_owner: Add COMM filtering with wildcard support Zhen Ni
2026-09-07 8:26 ` [PATCH v3 4/8] mm/page_owner: Refactor memcg handling for cgroup filter support Zhen Ni
2026-09-07 8:26 ` [PATCH v3 5/8] mm/page_owner: Add memcg " Zhen Ni
2026-09-07 8:26 ` [PATCH v3 6/8] tools/mm: Add PID/TGID/COMM filtering support to page_owner_filter Zhen Ni
2026-09-07 8:26 ` [PATCH v3 7/8] tools/mm: Add memory cgroup " Zhen Ni
2026-09-07 8:26 ` [PATCH v3 8/8] Documentation: page_owner: Document PID/TGID/COMM and cgroup filters Zhen Ni
2026-09-07 11:39 ` [PATCH v3 0/8] mm/page_owner: Add PID/TGID/COMM and cgroup filtering zhen.ni
2026-09-08 14:30 ` David Hildenbrand (Arm)
2026-09-09 2:35 ` zhen.ni
2026-09-09 10:28 ` David Hildenbrand (Arm)
2026-09-09 15:54 ` Zi Yan [this message]
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=22D1EC4B-FBCB-421E-B8DA-345B5F3505FB@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=liam@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=zhen.ni@easystack.cn \
/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