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

Cyril Hrubis chrubis@suse.cz
Mon Nov 11 13:08:19 CET 2024


Hi!
> On sle-micro 6.1, you can mount v1 controller when it was already mounted under v2
> And after you force mount v1 cpuset controller, the v2 cpuset controller will be removed
>
> localhost:~ # mount | grep cgroup
> cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
> 
> localhost:~ # ll /sys/fs/cgroup/
> total 0
> -r--r--r--  1 root root 0 Nov 11 01:39 cgroup.controllers
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.max.depth
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.max.descendants
> -rw-r--r--  1 root root 0 Nov 11 01:39 cgroup.procs
> -r--r--r--  1 root root 0 Nov 11 01:44 cgroup.stat
> -rw-r--r--  1 root root 0 Nov 11 01:39 cgroup.subtree_control
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.threads
> -r--r--r--  1 root root 0 Nov 11 01:44 cpu.stat
> -r--r--r--  1 root root 0 Nov 11 01:44 cpu.stat.local
> -r--r--r--  1 root root 0 Nov 11 01:44 cpuset.cpus.effective  <<<<
> -r--r--r--  1 root root 0 Nov 11 01:44 cpuset.mems.effective  <<<<
> drwxr-xr-x  2 root root 0 Nov 11 01:39 dev-hugepages.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 dev-mqueue.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 init.scope
> -rw-r--r--  1 root root 0 Nov 11 01:44 io.cost.model
> -rw-r--r--  1 root root 0 Nov 11 01:44 io.cost.qos
> -r--r--r--  1 root root 0 Nov 11 01:44 io.stat
> drwxr-xr-x  2 root root 0 Nov 11 01:39 machine.slice
> -r--r--r--  1 root root 0 Nov 11 01:44 memory.numa_stat
> --w-------  1 root root 0 Nov 11 01:44 memory.reclaim
> -r--r--r--  1 root root 0 Nov 11 01:44 memory.stat
> -r--r--r--  1 root root 0 Nov 11 01:44 misc.capacity
> drwxr-xr-x  2 root root 0 Nov 11 01:39 proc-fs-nfsd.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-fs-fuse-connections.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-kernel-config.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-kernel-debug.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-kernel-tracing.mount
> drwxr-xr-x 40 root root 0 Nov 11 01:42 system.slice
> drwxr-xr-x  2 root root 0 Nov 11 01:39 user.slice
> 
> localhost:/tmp # mkdir /var/tmp/cpuset
> localhost:/tmp # mount -t cgroup -o cpuset cpuset /var/tmp/cpuset  <<<<<<

You are supposed to get an error here, at least that is what I thought.

I do get error here on vanilla 6.10 but on debian 6.1 the mount succeeds
as well. CCing Michal.

Michal I was under an impression that a controller that has been bound
to v2 cannot be removed from there and bound to v1 anymore, but it seems
that it may happen in some cases.

> localhost:/tmp # ll /var/tmp/cpuset/
> total 0
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cgroup.clone_children
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cgroup.procs
> -r--r--r-- 1 root root 0 Nov 11 01:53 cgroup.sane_behavior
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.cpu_exclusive
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.cpus
> -r--r--r-- 1 root root 0 Nov 11 01:53 cpuset.effective_cpus
> -r--r--r-- 1 root root 0 Nov 11 01:53 cpuset.effective_mems
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.mem_exclusive
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.mem_hardwall
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.memory_migrate
> -r--r--r-- 1 root root 0 Nov 11 01:53 cpuset.memory_pressure
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.memory_pressure_enabled
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.memory_spread_page
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.memory_spread_slab
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.mems
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.sched_load_balance <<<<<<
> -rw-r--r-- 1 root root 0 Nov 11 01:53 cpuset.sched_relax_domain_level
> -rw-r--r-- 1 root root 0 Nov 11 01:53 notify_on_release
> -rw-r--r-- 1 root root 0 Nov 11 01:53 release_agent
> -rw-r--r-- 1 root root 0 Nov 11 01:53 tasks
> 
> localhost:/tmp # ll /sys/fs/cgroup/
> total 0
> -r--r--r--  1 root root 0 Nov 11 01:44 cgroup.controllers
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.max.depth
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.max.descendants
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.procs
> -r--r--r--  1 root root 0 Nov 11 01:44 cgroup.stat
> -rw-r--r--  1 root root 0 Nov 11 01:39 cgroup.subtree_control
> -rw-r--r--  1 root root 0 Nov 11 01:44 cgroup.threads
> -r--r--r--  1 root root 0 Nov 11 01:44 cpu.stat
> -r--r--r--  1 root root 0 Nov 11 01:44 cpu.stat.local
> drwxr-xr-x  2 root root 0 Nov 11 01:39 dev-hugepages.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 dev-mqueue.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 init.scope
> -rw-r--r--  1 root root 0 Nov 11 01:44 io.cost.model
> -rw-r--r--  1 root root 0 Nov 11 01:44 io.cost.qos
> -r--r--r--  1 root root 0 Nov 11 01:44 io.stat
> drwxr-xr-x  2 root root 0 Nov 11 01:39 machine.slice
> -r--r--r--  1 root root 0 Nov 11 01:44 memory.numa_stat
> --w-------  1 root root 0 Nov 11 01:44 memory.reclaim
> -r--r--r--  1 root root 0 Nov 11 01:44 memory.stat
> -r--r--r--  1 root root 0 Nov 11 01:44 misc.capacity
> drwxr-xr-x  2 root root 0 Nov 11 01:39 proc-fs-nfsd.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-fs-fuse-connections.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-kernel-config.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-kernel-debug.mount
> drwxr-xr-x  2 root root 0 Nov 11 01:39 sys-kernel-tracing.mount
> drwxr-xr-x 40 root root 0 Nov 11 02:01 system.slice
> drwxr-xr-x  2 root root 0 Nov 11 01:39 user.slice
> 
> localhost:/tmp # mount | grep cgroup
> cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
> cpuset on /var/tmp/cpuset type cgroup (rw,relatime,cpuset)

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list