What is root CGROUP?

爱⌒轻易说出口 提交于 2020-03-05 04:08:18

问题


here it is mentioned:

In the classic mode, which may ultimately be deprecated, but is still fully supported, there can be several separate cgroup hierarchies. Each hierarchy starts its life as a root cgroup, which initially holds all processes.


What is root CGROUP? In a Linux process model.


回答1:


Your article is talking about "classic" vs. "unified" (cgroup v2) cgroups:

https://lwn.net/Articles/606699/

As was recently reported, the 3.16 Linux kernel will have under-development support for a so-called "unified hierarchy". The new ideas introduced with that development will not be discussed yet, as we cannot really appreciate what value they might bring until we fully understand what we have....

In the classic mode, which may ultimately be deprecated, but is still fully supported, there can be several separate cgroup hierarchies. Each hierarchy starts its life as a root cgroup, which initially holds all processes. This root node is created by mounting an instance of the "cgroup" virtual filesystem and all further modifications to the hierarchy happen through manipulations of this filesystem,...

This is a very "organizational" way to manipulate a hierarchy: create a new group and find someone to fill it....

Here is a good article on the current status of v2 adoption (for example, viz. the Docker community):

The current adoption status of cgroup v2 in containers

Fedora 31 was released on October 29, 2019. This is the first major distro that comes with cgroup v2 (aka unified hierarchy) enabled by default, 5 years after it first appeared in Linux kernel 3.16 (Aug 3, 2014).

While the adoption of cgroup v2 is an inevitable step toward 2020s, most container implementations including Docker/Moby and Kubernetes still don’t support cgroup v2...

OK: to your question - "What is root CGROUP?"

All cgroups are hierarchical, so any cgroup can (and will) have a "root".

Per the documentation:

http://man7.org/linux/man-pages/man7/cgroups.7.html

Creating cgroups and moving processes

A cgroup filesystem initially contains a single root cgroup, '/', which all processes belong to. A new cgroup is created by creating a directory in the cgroup filesystem:

mkdir /sys/fs/cgroup/cpu/cg1

This creates a new empty cgroup.

A process may be moved to this cgroup by writing its PID into the cgroup's cgroup.procs file:

echo $$ > /sys/fs/cgroup/cpu/cg1/cgroup.procs

Only one PID at a time should be written to this file....

Useful articles:

  • https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html

  • https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt

  • https://medium.com/nttlabs/cgroup-v2-596d035be4d7

  • https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/resource_management_guide/chap-introduction_to_control_groups



来源:https://stackoverflow.com/questions/60075740/what-is-root-cgroup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!