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

Li Wang liwang@redhat.com
Fri Mar 20 04:27:45 CET 2026


On Fri, Mar 20, 2026 at 10:07:30AM +0800, Gao Xiang wrote:
> Replace hard-coded cgroup v1 memory controller handling in madvise09
> with the LTP cgroup framework and cgroup v2 control file names..
> 
> Rename the related limit variable to reflect the new interface instead
> of the old memsw naming since memsw.limit_in_bytes and memory.swap.max
> are different between cgroup v1 and v2.
> 
> Also fix the munmap length argument to unmap the whole mapped area.
> 
> Changes in v2:
> - Drop .needs_cgroup_ver = 2 becasue cgroup framework already maps
> v2 control files to v1.
> - Renmae the comments to use v2 control file names.

We usually add the change logs in git note:
  git notes add

> --- a/testcases/kernel/syscalls/madvise/madvise09.c
> +++ b/testcases/kernel/syscalls/madvise/madvise09.c
> @@ -17,8 +17,8 @@
>   * o Write to some of the madvised pages again, these must not be freed
>   *
>   * o Set memory limits
> - *   - limit_in_bytes = 8MB
> - *   - memsw.limit_in_bytes = 16MB
> + *   - memory.max = 8MB
> + *   - memory.swap.max = 16MB
>   *
>   *   The reason for doubling the limit_in_bytes is to have safe margin
>   *   for forking the memory hungy child etc. And the reason to setting

I have modified all the relevant ctrl-file names and pushed. Thank you!

-- 
Regards,
Li Wang



More information about the ltp mailing list