All of lore.kernel.org
 help / color / mirror / Atom feed
* Misunderstanding documentation on enabling cgroup controllers
@ 2022-08-19  8:24 Nicky Chorley
  2022-08-21 18:14 ` Valentin Vidić
  0 siblings, 1 reply; 2+ messages in thread
From: Nicky Chorley @ 2022-08-19  8:24 UTC (permalink / raw)
  To: kernelnewbies

Hi folks,

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?

Thanks.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Misunderstanding documentation on enabling cgroup controllers
  2022-08-19  8:24 Misunderstanding documentation on enabling cgroup controllers Nicky Chorley
@ 2022-08-21 18:14 ` Valentin Vidić
  0 siblings, 0 replies; 2+ messages in thread
From: Valentin Vidić @ 2022-08-21 18:14 UTC (permalink / raw)
  To: kernelnewbies

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@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-21 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19  8:24 Misunderstanding documentation on enabling cgroup controllers Nicky Chorley
2022-08-21 18:14 ` Valentin Vidić

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.