Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests: cgroup: test_dmem always skips under kselftest
  runner
--

commit b1601ac573b3434d7a724ddf07cd272e92c72579
Author: Albert Esteve <[email protected]>

selftests: cgroup: Add dmem selftest coverage

This commit adds the test_dmem selftest to verify dmem.max enforcement and
byte-granularity accounting using the dmem_selftest kernel module.

> diff --git a/tools/testing/selftests/cgroup/Makefile 
> b/tools/testing/selftests/cgroup/Makefile
> index a08661320a07c..d01e8eb1ead2d 100644
> --- a/tools/testing/selftests/cgroup/Makefile
> +++ b/tools/testing/selftests/cgroup/Makefile
> @@ -11,6 +11,7 @@ TEST_GEN_MODS_DIR := test_modules
>  TEST_GEN_PROGS  = test_core
>  TEST_GEN_PROGS += test_cpu
>  TEST_GEN_PROGS += test_cpuset
> +TEST_GEN_PROGS += test_dmem
>  TEST_GEN_PROGS += test_freezer
>  TEST_GEN_PROGS += test_hugetlb_memcg
>  TEST_GEN_PROGS += test_kill
[ ... ]
> diff --git a/tools/testing/selftests/cgroup/test_dmem.c 
> b/tools/testing/selftests/cgroup/test_dmem.c
> new file mode 100644
> index 0000000000000..3793664678b91
> --- /dev/null
> +++ b/tools/testing/selftests/cgroup/test_dmem.c
[ ... ]
> +int main(int argc, char **argv)
> +{
> +     char root[PATH_MAX];
> +     struct stat st;
> +     int i;
> +
> +     ksft_print_header();
> +
> +     if (cg_find_unified_root(root, sizeof(root), NULL))
> +             ksft_exit_skip("cgroup v2 isn't mounted\n");
> +
> +     if (cg_read_strstr(root, "cgroup.controllers", "dmem"))
> +             ksft_exit_skip("dmem controller isn't available 
> (CONFIG_CGROUP_DMEM?)\n");
> +
> +     if (cg_read_strstr(root, "cgroup.subtree_control", "dmem"))
> +             if (cg_write(root, "cgroup.subtree_control", "+dmem"))
> +                     ksft_exit_skip("Failed to enable dmem controller\n");
> +
> +     if (stat(DM_SELFTEST_ALLOC, &st) < 0)
> +             ksft_exit_skip(
> +                     "dmem_selftest helper not loaded (insmod 
> test_modules/dmem_selftest.ko)\n");

[Severity: Medium]
Will test_dmem always be skipped when run via the standard kselftest runner
(make run_tests or run_kselftest.sh)?

The kselftest framework builds and installs modules in TEST_GEN_MODS_DIR,
but runner.sh executes TEST_GEN_PROGS directly without loading those
modules first.  Unless test_dmem loads and unloads
test_modules/dmem_selftest.ko itself (for example via finit_module() and
delete_module()) or is invoked through a wrapper script in TEST_PROGS,
automated kselftest runs will never execute these tests.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to