public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang via ltp <ltp@lists.linux.it>
To: Soma Das <somadas1@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] cgroup: make regression test compatible with cgroup v2
Date: Fri, 3 Apr 2026 10:30:31 +0800	[thread overview]
Message-ID: <ac8mR-0enzhgMeka@redhat.com> (raw)
In-Reply-To: <20260402082546.3245433-1-somadas1@linux.ibm.com>

Hi Soma,

First, thank you for cleanup this test. Yes, it is only compatible
on Cgroup v1, and it's definately could compatible v2 just with
some adjutment.

But I'd like suggest to make use of the LTP standard Cgroup API, for
version-check, mount/unmount, ctrl-file set, etc.

You can take a look at the cgroup_lib.sh, I think it will be more
convenient to reuse the mature APIs.

>  test2()
>  {
> +	if mount | grep -q "type cgroup2"; then
> +		tst_res TCONF "cgroup v2 already active - cannot mount v1 on this kernel"
> +		return
> +	fi
> +
>  	local val1
>  	local val2
> -	local cgroup_version
> +	local cgroup_mount="$PWD/cgroup"
>  

> -	cgroup_require "memory"
> -	cgroup_version=$(cgroup_get_version "memory")
> -	if [ "$cgroup_version" = "2" ]; then
> -		tst_res TCONF "This test requires cgroup v1, but system is using cgroup v2"
> -		cgroup_cleanup

The code you removed here is actually what we recommended as a way to
check the system's cgroup version :).

We can not simply rely on kernel versions to think the cgroup versions,
because for different Linux distributions, it may backport the new
feature to old kernels, and kind of Linux supports v1 and v2 flexibly.

-- 
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2026-04-03  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02  8:25 [LTP] [PATCH] cgroup: make regression test compatible with cgroup v2 Soma Das
2026-04-03  2:30 ` Li Wang via ltp [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac8mR-0enzhgMeka@redhat.com \
    --to=ltp@lists.linux.it \
    --cc=liwang@redhat.com \
    --cc=somadas1@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox