Re: [LTP] [PATCH v1] tst_cgroup.c: Force tst_cg_scan only scan specific cgroup version if needs_ver exist

Wei Gao via ltp
2024-11-08T11:22:28Z

On Fri, Nov 08, 2024 at 10:53:11AM +0100, Cyril Hrubis wrote:
> Hi!
> > tst_cgroup.c will scan cgroup mount point and check system's cgroup support status, both
> > cgroupv1 and cgroupv2, if your case only need check cgroupv1(such as needs_cgroup_ver = TST_CG_V1)
> > but your system contain cgroupv2 mount point, then TCONF will happen tell you your system already
> > mount cgroupv2, so test case will be skipped.
>
> I do not get what happens here. What is the exact test output that does
> not work for you?

If you add .needs_cgroup_ver = TST_CG_V1 in cpuset02.c and running on sle-micro you will hit
https://github.com/linux-test-project/ltp/blob/6408294d83682635393e36c14bbd6ebd94fead94/lib/tst_cgroup.c#L892

Since sle-micro platform already create cgroupv2 mount point, the tst_cg_scan will get cgroupv2 info and
will not call cgroup_mount_v1.

>
> We have tst_cg_require() which attempts to mount either v1 or v2 as
> described in options. However a controller can be mouted either in v1 or
> v2 but not in both, so skipping the scan will not solve anything.
>
> --
> Cyril Hrubis
> chrubis@suse.cz