mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] selftests and sample for bpf_proactive_reclaim
@ 2026-09-24  4:04 Hui Zhu
  2026-09-24  4:04 ` [PATCH bpf-next 1/2] selftests/bpf: Add bpf_proactive_reclaim test Hui Zhu
  2026-09-24  4:04 ` [PATCH bpf-next 2/2] samples/bpf: Add memcg async reclaim example Hui Zhu
  0 siblings, 2 replies; 5+ messages in thread
From: Hui Zhu @ 2026-09-24  4:04 UTC (permalink / raw)
  To: Roman Gushchin, JP Kobryn, Shakeel Butt, Andrew Morton,
	Andrii Nakryiko, Eduard Zingerman, Ihor Solodrai,
	Alexei Starovoitov, Daniel Borkmann, Kumar Kartikeya Dwivedi,
	Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
	Emil Tsalapatis, Shuah Khan, David Hildenbrand, Barry Song,
	Geliang Tang, David S. Miller, Jakub Kicinski,
	Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
	linux-kernel, bpf, linux-mm, linux-kselftest, netdev
  Cc: Hui Zhu

From: Hui Zhu <zhuhui@kylinos.cn>

This series follows the bpf_proactive_reclaim() kfunc patch (v14, acked
by Shakeel Butt, reviewed by JP Kobryn and Barry Song). Review feedback
on that series was that ~1200 lines of selftest for a ~20 line kfunc is
overkill, so the test material is split in two:

1/2 is the minimal selftest. It mirrors the memory.reclaim selftest:
charge a cgroup, call the kfunc once, and check the single bounded pass
semantics (one call reclaims at most MEMCG_CHARGE_BATCH pages and, unlike
a write to memory.reclaim, does not retry until the goal is reached).

2/2 moves the complex asynchronous scenario out of the selftests and into
samples/bpf, where it belongs: a BPF program watches the workingset
refaults of a pressured cgroup and, when they grow, reclaims a target
cgroup from a bpf_wq callback through bpf_proactive_reclaim(). It runs
in two modes: bench recreates the high/low priority benchmark of the old
selftest, and watch keeps reclaiming for user-specified cgroups as a
simple proactive-reclaim daemon. Besides exercising the kfunc end to
end, the sample is meant as a design reference for anyone building their
own BPF-driven reclaim policy on bpf_proactive_reclaim(), bpf_wq and the
memcg kfuncs.

Hui Zhu (2):
  selftests/bpf: Add bpf_proactive_reclaim test
  samples/bpf: Add memcg async reclaim example

 samples/bpf/.gitignore                        |    1 +
 samples/bpf/Makefile                          |   10 +-
 samples/bpf/memcg_async_reclaim.bpf.c         |  349 +++++
 samples/bpf/memcg_async_reclaim.h             |   39 +
 samples/bpf/memcg_async_reclaim_user.c        | 1141 +++++++++++++++++
 tools/testing/selftests/bpf/config            |    1 +
 .../bpf/prog_tests/memcg_proactive_reclaim.c  |  124 ++
 .../bpf/progs/memcg_proactive_reclaim.c       |   34 +
 8 files changed, 1698 insertions(+), 1 deletion(-)
 create mode 100644 samples/bpf/memcg_async_reclaim.bpf.c
 create mode 100644 samples/bpf/memcg_async_reclaim.h
 create mode 100644 samples/bpf/memcg_async_reclaim_user.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/memcg_proactive_reclaim.c
 create mode 100644 tools/testing/selftests/bpf/progs/memcg_proactive_reclaim.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-24  5:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24  4:04 [PATCH bpf-next 0/2] selftests and sample for bpf_proactive_reclaim Hui Zhu
2026-09-24  4:04 ` [PATCH bpf-next 1/2] selftests/bpf: Add bpf_proactive_reclaim test Hui Zhu
2026-09-24  4:04 ` [PATCH bpf-next 2/2] samples/bpf: Add memcg async reclaim example Hui Zhu
2026-09-24  5:02   ` bot+bpf-ci
2026-09-24  5:35   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®