v3 2026-10-25

page_owner 增加 bpf_iter 与 kfunc · v3

为page_owner添加bpf_iter目标和kfunc,使BPF可遍历页分配者并获取memcg信息。

原始补丁链接

子 Patch(7)

1/7
mm/page_owner: extract page_owner_next_eligible() from read loop
[mm/page_owner: extract page_owner_next_eligible() from read loop] Move the page scanning logic out of read_page_owner() into a dedicated helper, in preparation for using it in the page_owner bpf_iter
2/7
mm/page_owner: protect page access with mem-hotplug read lock
[mm/page_owner: protect page access with mem-hotplug read lock] The page_owner scan walks PFNs locklessly and dereferences the resolved struct page in the scan itself and in print_page_owner(). With C
3/7
mm/page_owner: add bpf_iter target "page_owner"
[mm/page_owner: add bpf_iter target “page_owner”] Register a bpf_iter target “page_owner” that walks the pages eligible for page_owner output, with the same eligibility rules as the /sys/kernel/debug/
4/7
mm/page_owner: add open-coded page_owner iterator
[mm/page_owner: add open-coded page_owner iterator] Add an open-coded bpf_iter over the pages eligible for page_owner output, reusing page_owner_next_eligible(). A sleepable BPF program drives it wit
5/7
mm/page_owner: record the NUMA node in the scan cursor
[mm/page_owner: record the NUMA node in the scan cursor] Compute the page’s NUMA node in page_owner_next_eligible() while the page is still valid, and store it in scan->nid. The debugfs nid filter re
6/7
mm/page_owner: add bpf_page_owner_get_memcg_info() kfunc
[mm/page_owner: add bpf_page_owner_get_memcg_info() kfunc] Expose per-page memcg information to BPF programs, so that a bpf_iter over page_owner can aggregate and filter allocations by memcg. Attribut
7/7
selftests/bpf: add tests for the page_owner bpf_iter target
[selftests/bpf: add tests for the page_owner bpf_iter target] Add a sleepable BPF program and a userspace runner covering the seq_file and open-coded page_owner iterators. The test checks: - seq_fi