From: sashiko-bot@kernel.org
To: "Zhen Ni" <zhen.ni@easystack.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v2 3/6] mm/page_owner: add open-coded page_owner iterator
Date: Tue, 13 Oct 2026 12:49:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-169742@kernel.org> (raw)
In-Reply-To: <20261013122125.843451-4-zhen.ni@easystack.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mm: soft lockup in page_owner_next_eligible via BPF iter
--
commit b7f01516d35223b7a6800ce695c29a9203809699
Author: Zhen Ni <zhen.ni@easystack.cn>
mm/page_owner: add open-coded page_owner iterator
This patch adds an open-coded bpf_iter over the pages eligible for
page_owner output, reusing page_owner_next_eligible(). It also provides a
sleepable BPF program to drive the iterator and retrieve stack traces.
> diff --git a/mm/page_owner_iter.c b/mm/page_owner_iter.c
> index 938cb42ab7d79..ac7e69ba0cef3 100644
> --- a/mm/page_owner_iter.c
> +++ b/mm/page_owner_iter.c
[ ... ]
> @@ -122,3 +123,55 @@ int page_owner_iter_register(void)
>
> return bpf_iter_reg_target(&page_owner_iter_reg_info);
> }
> +
> +/* opaque to BPF programs */
> +struct bpf_iter_page_owner {
> + __u64 __opaque[16];
> +} __attribute__((aligned(8)));
> +
> +struct bpf_iter_page_owner_kern {
> + struct page_owner_scan scan;
> +} __attribute__((aligned(8)));
> +
> +__bpf_kfunc_start_defs();
[ ... ]
> +__bpf_kfunc struct page_owner_scan *
> +bpf_iter_page_owner_next(struct bpf_iter_page_owner *it)
> +{
> + struct bpf_iter_page_owner_kern *kit = (void *)it;
> +
> + cond_resched();
> +
> + if (kit->scan.page)
> + kit->scan.pfn++;
> +
> + if (!page_owner_next_eligible(&kit->scan))
> + return NULL;
[Severity: High]
Can this iterator cause a soft lockup or RCU stall?
If page_owner is disabled, page_ext_get() inside page_owner_next_eligible()
constantly returns NULL, triggering a continue on every single page up to
max_pfn:
mm/page_owner.c:page_owner_next_eligible() {
...
for (; pfn < max_pfn; pfn++) {
...
page_ext = page_ext_get(page);
if (unlikely(!page_ext))
continue;
...
ext_put_continue:
page_ext_put(page_ext);
cond_resched();
}
...
}
Because the continue statement skips the ext_put_continue block, the loop
never calls cond_resched(). When called from this new sleepable BPF
iterator, won't it spin over the entire physical memory space in a tight
loop without yielding?
> +
> + return &kit->scan;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013122125.843451-1-zhen.ni@easystack.cn?part=3
next prev parent reply other threads:[~2026-10-13 12:49 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 [this message]
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 ` [PATCH v2 0/6] mm/page_owner: add bpf_iter and kfuncs 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=sashiko-outbox-169742@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox