All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zi Yan" <ziy@nvidia.com>
To: "Zhen Ni" <zhen.ni@easystack.cn>, <ast@kernel.org>,
	<daniel@iogearbox.net>, <andrii@kernel.org>, <eddyz87@gmail.com>,
	<memxor@gmail.com>, <martin.lau@linux.dev>, <song@kernel.org>,
	<yonghong.song@linux.dev>, <jolsa@kernel.org>,
	<emil@etsalapatis.com>, <ihor.solodrai@linux.dev>,
	<akpm@linux-foundation.org>, <vbabka@kernel.org>,
	<surenb@google.com>, <mhocko@suse.com>,
	<brendan.jackman@linux.dev>, <hannes@cmpxchg.org>,
	<shuah@kernel.org>
Cc: <bpf@vger.kernel.org>, <linux-mm@kvack.org>,
	<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 0/6] mm/page_owner: add bpf_iter and kfuncs
Date: Tue, 13 Oct 2026 13:17:44 -0400	[thread overview]
Message-ID: <DM3VQQ8KZGGF.FODPE8YAHBE7@nvidia.com> (raw)
In-Reply-To: <20261013122125.843451-1-zhen.ni@easystack.cn>

On Tue Oct 13, 2026 at 8:21 AM EDT, Zhen Ni wrote:
> Hi all,
>
> Introduction
> ============
>
> page_owner records who allocated every page and is a core memory-debug
> facility, but it currently reaches userspace as the debugfs flat dump:
> slicing allocations by pid, comm, NUMA node, cgroup or stack, etc.,
> means streaming and parsing the entire file in userspace, which is
> expensive on large hosts and hard to query live.
>
> Exposing the same walk to eBPF lets a program filter and aggregate in
> the kernel and surface only the records it cares about. This series
> adds that access as a seq_file bpf_iter target and an open-coded
> iterator.
>
> Implementation
> ==============
>
> The page walk is factored into page_owner_next_eligible(), shared by
> the read path and the iterators so eligibility stays identical. Two
> kfuncs expose information that a BPF program cannot decode from the
> snapshot alone: per-page memcg info including the full cgroup path,
> and the stack trace behind a stack_depot handle. Each record is
> snapshotted under the page_ext RCU lock, so consumers read a
> consistent copy.
>
> Testing
> =======
>
> The selftest exercises the seq_file and open-coded iterators, and
> validates the stack_snprint and get_memcg_info kfuncs.
>
> Changes in v2
> =============
> - Route the zero-handle case through ext_put_continue.
> - Drop the scan->pfn++.
> - Fill page/po/pfn only when v is non-NULL.
> - Implement page_owner_seq_stop().
> - bpf_page_owner_stack_snprint() now takes the scan cursor.
> - Buffer args renamed to buf__uninit/buf__sz.
> - Removes the v1 get_nid() kfunc. The node is now stored in scan->nid.
> - bpf_page_owner_get_memcg_info() now resolves the page with
>   pfn_to_online_page() for an offline or removed pfn.
> - Buffer/info args renamed to info__uninit/buf__uninit/buf__sz.
> - Drop the get_nid kfunc coverage.
> - Enable CONFIG_PAGE_OWNER in the bpf selftests config.

Hi Zhen,

Thank you for your patches. Review focus is currently on hotfixes and
patches already in mm tree. Please ping us on this after the merge
window is close, if no one still has not looked at it by then.

Thanks.

>
> v1: https://lore.kernel.org/linux-mm/20261009112308.240769-1-zhen.ni@easystack.cn/
>
> Zhen Ni (6):
>   mm/page_owner: extract page_owner_next_eligible() from read loop
>   mm/page_owner: add bpf_iter target "page_owner"
>   mm/page_owner: add open-coded page_owner iterator
>   mm/page_owner: record the NUMA node in the scan cursor
>   mm/page_owner: add bpf_page_owner_get_memcg_info() kfunc
>   selftests/bpf: add tests for the page_owner bpf_iter target
>
>  kernel/bpf/helpers.c                          |   7 +
>  mm/Makefile                                   |   3 +
>  mm/page_owner.c                               | 219 +++++++++++-------
>  mm/page_owner.h                               |  58 +++++
>  mm/page_owner_iter.c                          | 197 ++++++++++++++++
>  tools/testing/selftests/bpf/config            |   2 +
>  .../bpf/prog_tests/page_owner_iter.c          | 193 +++++++++++++++
>  .../selftests/bpf/progs/bpf_iter_page_owner.c | 159 +++++++++++++
>  8 files changed, 758 insertions(+), 80 deletions(-)
>  create mode 100644 mm/page_owner.h
>  create mode 100644 mm/page_owner_iter.c
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/page_owner_iter.c
>  create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_page_owner.c




-- 
Best Regards,
Yan, Zi


      parent reply	other threads:[~2026-10-13 17:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 12:21 [PATCH v2 0/6] mm/page_owner: add bpf_iter and kfuncs Zhen Ni
2026-10-13 12:21 ` [PATCH v2 1/6] mm/page_owner: extract page_owner_next_eligible() from read loop Zhen Ni
2026-10-13 12:21 ` [PATCH v2 2/6] mm/page_owner: add bpf_iter target "page_owner" Zhen Ni
2026-10-13 13:51   ` bot+bpf-ci
2026-10-13 12:21 ` [PATCH v2 3/6] mm/page_owner: add open-coded page_owner iterator Zhen Ni
2026-10-13 12:49   ` sashiko-bot
2026-10-13 13:51   ` bot+bpf-ci
2026-10-13 12:21 ` [PATCH v2 4/6] mm/page_owner: record the NUMA node in the scan cursor Zhen Ni
2026-10-13 12:36   ` sashiko-bot
2026-10-13 12:21 ` [PATCH v2 5/6] mm/page_owner: add bpf_page_owner_get_memcg_info() kfunc Zhen Ni
2026-10-13 12:49   ` sashiko-bot
2026-10-13 12:21 ` [PATCH v2 6/6] selftests/bpf: add tests for the page_owner bpf_iter target Zhen Ni
2026-10-13 12:38   ` sashiko-bot
2026-10-13 17:17 ` 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=DM3VQQ8KZGGF.FODPE8YAHBE7@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brendan.jackman@linux.dev \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=hannes@cmpxchg.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=mhocko@suse.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=yonghong.song@linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.