[PATCH 0/3] cgroup: dmem: add selftest helper, coverage, and VM runner
From: Albert Esteve
Date: Fri Mar 27 2026 - 04:59:13 EST
Hi all,
This small series adds practical test coverage for the dmem
cgroup controller.
The motivation came from following the recent dmem API discussion in
thread [1]. That discussion considered changing the dmem API and
adding a new knob. Currently there are no dedicated tests covering
dmem behaviour, which makes such changes riskier.
Adding selftests has an additional challenge: dmem charging paths
are driver-driven today, so regression testing harder unless a
suitable driver is present in the test environment.
This series addresses that by adding:
- a kernel-side selftest helper module to trigger charge/uncharge
from userspace in a controlled way,
- cgroup selftests covering dmem accounting and protection semantics
(including dmem.max enforcement and byte-granularity checks),
- a virtme-based VM runner for repeatable execution of the dmem tests.
The goal is to make dmem behavior easier to validate when evolving the API
and implementation, while keeping tests deterministic and driver-independent.
Thanks.
[1] - https://lore.kernel.org/all/aZoHfloupKvF2oSu@fedora/
Signed-off-by: Albert Esteve <aesteve@xxxxxxxxxx>
---
Albert Esteve (3):
cgroup: Add dmem_selftest module
selftests: cgroup: Add dmem selftest coverage
selftests: cgroup: Add vmtest-dmem runner based on hid vmtest
init/Kconfig | 12 +
kernel/cgroup/Makefile | 1 +
kernel/cgroup/dmem_selftest.c | 192 ++++++++++
tools/testing/selftests/cgroup/.gitignore | 1 +
tools/testing/selftests/cgroup/Makefile | 2 +
tools/testing/selftests/cgroup/test_dmem.c | 487 ++++++++++++++++++++++++++
tools/testing/selftests/cgroup/vmtest-dmem.sh | 189 ++++++++++
7 files changed, 884 insertions(+)
---
base-commit: 80234b5ab240f52fa45d201e899e207b9265ef91
change-id: 20260318-kunit_cgroups-7fb0b9e64017
Best regards,
--
Albert Esteve <aesteve@xxxxxxxxxx>