On Mon, Jul 06, 2026 at 02:06:41PM +0200, Albert Esteve wrote: > Currently, tools/testing/selftests/cgroup/ does not include > a dmem-specific test binary. This leaves dmem charge and > limit behavior largely unvalidated in kselftest coverage. > > Add test_dmem and wire it into the cgroup selftests Makefile. > The new test exercises dmem controller behavior through the > dmem_selftest debugfs interface for the dmem_selftest region. > > The test adds three complementary checks: > - test_dmem_max creates a nested hierarchy with per-leaf > dmem.max values and verifies that over-limit charges > fail while in-limit charges succeed in dmem.current. > - test_dmem_min and test_dmem_low verify that charging > from a cgroup with the corresponding protection knob > set updates dmem.current as expected. > - test_dmem_charge_byte_granularity validates accounting > bounds for non-page-aligned charge sizes and > uncharge-to-zero behavior. > > This provides deterministic userspace coverage for dmem > accounting and hard-limit enforcement using a test helper > module, without requiring subsystem-specific production > drivers. > > Signed-off-by: Albert Esteve <[email protected]>
Reviewed-by: Eric Chanudet <[email protected]> -- Eric Chanudet

