Re: Misunderstanding documentation on enabling cgroup controllers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 19, 2022 at 09:24:53AM +0100, Nicky Chorley wrote:
> The documentation for enabling and disabling cgroup controllers at
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/cgroup-v2.rst#n403
> says that no controllers are enabled by default and to enable them,
> one needs to write into cgroup.subtree_control.
> 
> I thought this meant that if I didn't enable a controller, I couldn't
> control those resources. However, I wrote a program to limit the
> number of processes in a cgroup and it works as expected - if I try to
> create more processes, I'm unable to. I didn't write "+pids" into
> cgroup.subtree_control - that file remains empty.
> 
> Am I misunderstanding the documentation, then?

AFAICT, it seems to be working as documented. It means that whatever
you put have in cgroup.subtree_control becomes cgroup.controllers in
a subdirectory. For example:

# cat /sys/fs/cgroup/cgroup.controllers 
cpuset cpu io memory hugetlb pids rdma
# cat /sys/fs/cgroup/cgroup.subtree_control 
cpuset cpu io memory pids

# mkdir /sys/fs/cgroup/dir1
# cat /sys/fs/cgroup/dir1/cgroup.controllers 
cpuset cpu io memory pids
# cat /sys/fs/cgroup/dir1/cgroup.subtree_control 
# ls /sys/fs/cgroup/dir1
cgroup.controllers      cpuset.cpus            memory.max
cgroup.events           cpuset.cpus.effective  memory.min
cgroup.freeze           cpuset.cpus.partition  memory.numa_stat
cgroup.max.depth        cpuset.mems            memory.oom.group
cgroup.max.descendants  cpuset.mems.effective  memory.pressure
cgroup.procs            dir2                   memory.stat
cgroup.stat             io.max                 memory.swap.current
cgroup.subtree_control  io.pressure            memory.swap.events
cgroup.threads          io.stat                memory.swap.high
cgroup.type             io.weight              memory.swap.max
cpu.max                 memory.current         pids.current
cpu.pressure            memory.events          pids.events
cpu.stat                memory.events.local    pids.max
cpu.weight              memory.high
cpu.weight.nice         memory.low

# mkdir /sys/fs/cgroup/dir1/dir2
# cat /sys/fs/cgroup/dir1/dir2/cgroup.controllers
# cat /sys/fs/cgroup/dir1/dir2/cgroup.subtree_control 
# ls /sys/fs/cgroup/dir1/dir2
cgroup.controllers  cgroup.max.descendants  cgroup.threads  io.pressure
cgroup.events       cgroup.procs            cgroup.type memory.pressure
cgroup.freeze       cgroup.stat             cpu.pressure
cgroup.max.depth    cgroup.subtree_control  cpu.stat

-- 
Valentin

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux