Re: [PATCH bpf-next v12 2/2] selftests/bpf: Add memcg async reclaim test

From: Shakeel Butt

Date: Fri Sep 18 2026 - 13:57:33 EST


On Fri, Sep 18, 2026 at 03:41:12PM +0000, Alexei Starovoitov wrote:
> On Fri, Sep 18, 2026 at 02:58 PM Hui Zhu <hui.zhu@xxxxxxxxx> wrote:
> > From: Hui Zhu <zhuhui@xxxxxxxxxx>
> >
> > Exercise BPF-driven async proactive reclaim. A BPF program watches the
> > refault stats of a memory-pressured cgroup and, once they grow, reclaims
> > a second cgroup from a bpf_wq callback through bpf_proactive_reclaim().
> > Pass/fail rests on the reclaim counters. The workload timings are a
> > benchmark, not a criterion, so they are logged only under
> > TEST_MEMCG_ASYNC_RECLAIM_BENCH=1, which also runs a baseline without the
> > BPF program, recreating the cgroups in between so both runs start cold.
>
> [...]
>
> > Signed-off-by: Hui Zhu <zhuhui@xxxxxxxxxx>
> > ---
> > tools/testing/selftests/bpf/config | 1 +
> > .../bpf/prog_tests/memcg_async_reclaim.c | 890 ++++++++++++++++++
> > .../selftests/bpf/progs/memcg_async_reclaim.c | 327 +++++++
> > 3 files changed, 1218 insertions(+)
>
> 1200 lines of selftest for a 20 line kfunc ?
> Sorry that's an overkill.

Yeah I agree. Also I understand that BPF would prefer to have very fast and
minimal selftests and selftest for a memory reclaim kfunc would not be that.

We have memory.reclaim selftests in cgroup, maybe that would be a better home.
Basically whatever we do for memory.reclaim, do the same but using this kfunc.
If you don't mind, why not let's just take the patch 1 in bpf tree for now and
we will cover the selftest in next release but in cgroup selftests.