From: Hui Zhu <hui.zhu@linux.dev>
To: Roman Gushchin <roman.gushchin@linux.dev>,
JP Kobryn <inwardvessel@gmail.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Shuah Khan <shuah@kernel.org>,
David Hildenbrand <david@kernel.org>,
Barry Song <baohua@kernel.org>, Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
netdev@vger.kernel.org
Cc: Hui Zhu <zhuhui@kylinos.cn>
Subject: [PATCH bpf-next 0/2] selftests and sample for bpf_proactive_reclaim
Date: Thu, 24 Sep 2026 12:04:31 +0800 [thread overview]
Message-ID: <cover.1790222105.git.zhuhui@kylinos.cn> (raw)
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
next reply other threads:[~2026-09-24 4:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 4:04 Hui Zhu [this message]
2026-09-24 4:04 ` [PATCH bpf-next 1/2] selftests/bpf: Add bpf_proactive_reclaim test Hui Zhu
2026-09-24 4:14 ` sashiko-bot
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
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=cover.1790222105.git.zhuhui@kylinos.cn \
--to=hui.zhu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=baohua@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=david@kernel.org \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=geliang@kernel.org \
--cc=hawk@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=inwardvessel@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@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=netdev@vger.kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=sdf@fomichev.me \
--cc=shakeel.butt@linux.dev \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
--cc=zhuhui@kylinos.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.