User Tools

Site Tools


cgroupsv2

This is an old revision of the document!


Overview

Stuff about cgroups v2.

Kernel files

arch/x86/configs/x86_64_defconfig

CONFIG_CGROUPS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_SCHED=y

init/Kconfig

menuconfig CGROUPS
        bool "Control Group support"
        select KERNFS
        help
          This option adds support for grouping sets of processes together, for
          use with process control subsystems such as Cpusets, CFS, memory
          controls or device isolation.
          See
                - Documentation/scheduler/sched-design-CFS.rst  (CFS)
                - Documentation/admin-guide/cgroup-v1/ (features for grouping, isolation
                                          and resource control)

          Say N if unsure.

kernel/Makefile

obj-$(CONFIG_CGROUPS) += cgroup/

kernel/cgroup/

-rw-rw-r--. 1 rpjday rpjday 174723 Jul 22 05:47 cgroup.c
-rw-rw-r--. 1 rpjday rpjday   8819 May 14 06:14 cgroup-internal.h
-rw-rw-r--. 1 rpjday rpjday  34559 Jun  1 16:37 cgroup-v1.c
-rw-rw-r--. 1 rpjday rpjday 100438 Jul 22 05:47 cpuset.c
-rw-rw-r--. 1 rpjday rpjday   8409 May 14 06:14 debug.c
-rw-rw-r--. 1 rpjday rpjday   7749 May 14 06:14 freezer.c
-rw-rw-r--. 1 rpjday rpjday  12686 May 14 06:14 legacy_freezer.c
-rw-rw-r--. 1 rpjday rpjday    289 May 14 06:14 Makefile
-rw-rw-r--. 1 rpjday rpjday   3412 Jan 18  2019 namespace.c
-rw-rw-r--. 1 rpjday rpjday   8958 Jul  8 17:43 pids.c
-rw-rw-r--. 1 rpjday rpjday  15012 Jul  8 17:43 rdma.c
-rw-rw-r--. 1 rpjday rpjday  11149 Jun  1 16:37 rstat.c
# SPDX-License-Identifier: GPL-2.0
obj-y := cgroup.o rstat.o namespace.o cgroup-v1.o freezer.o

obj-$(CONFIG_CGROUP_FREEZER) += legacy_freezer.o
obj-$(CONFIG_CGROUP_PIDS) += pids.o
obj-$(CONFIG_CGROUP_RDMA) += rdma.o
obj-$(CONFIG_CPUSETS) += cpuset.o
obj-$(CONFIG_CGROUP_DEBUG) += debug.o

Mount points

$ mount -t cgroup
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,name=systemd)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
$
$ mount -t cgroup2
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate)
$

sysfs implementation

cgroupsv2.1564317633.txt.gz · Last modified: 2019/07/28 12:40 by rpjday