[LTP] [PATCH] madvise09: support cgroup v2 via LTP cgroup API

Li Wang liwang@redhat.com
Thu Mar 19 13:34:18 CET 2026


Gao Xiang wrote:

> --- a/testcases/kernel/syscalls/madvise/madvise09.c
> +++ b/testcases/kernel/syscalls/madvise/madvise09.c
> @@ -18,7 +18,7 @@
>   *
>   * o Set memory limits
>   *   - limit_in_bytes = 8MB
> - *   - memsw.limit_in_bytes = 16MB
> + *   - swap.limit_in_bytes = 16MB

The previous ctrl-files in Cgroup v1 naming which should match in v2 as:
  memory.limit_in_bytes -> memory.max
  memory.memsw.limit_in_bytes -> memory.swap.max

Maybe we should standardize all the names in the comments to v2.

See: ltp/lib/tst_cgroup.c line#183.

> ...
>  static struct tst_test test = {
>  	.setup = setup,
> -	.cleanup = cleanup,
>  	.test_all = run,
>  	.needs_root = 1,
>  	.forks_child = 1,

> +	.needs_cgroup_ver = 2,

LTP now supports automatically mapping v2 control files to v1,
therefore, there is no need to set cgroup_ver restrictions here.

IOW, with your patch applied, madvise09 works well on Cgroup v1 too.

-- 
Regards,
Li Wang



More information about the ltp mailing list