# cgroups给用户暴露出来的操作接口是文件系统 $ ll /sys/fs/cgroup/ total 0 dr-xr-xr-x. 6 root root 0 Jan 30 10:16 blkio # 为块设备制定IO限制 lrwxrwxrwx. 1 root root 11 Jan 30 10:16 cpu -> cpu,cpuacct # cpu限制 dr-xr-xr-x. 6 root root 0 Jan 30 10:16 cpu,cpuacct lrwxrwxrwx. 1 root root 11 Jan 30 10:16 cpuacct -> cpu,cpuacct dr-xr-xr-x. 3 root root 0 Jan 30 10:16 cpuset # 为进程分配单独的cpu核和对应的内存节点 dr-xr-xr-x. 6 root root 0 Jan 30 10:16 devices dr-xr-xr-x. 3 root root 0 Jan 30 10:16 freezer dr-xr-xr-x. 3 root root 0 Jan 30 10:16 hugetlb dr-xr-xr-x. 6 root root 0 Jan 30 10:16 memory # 内存限制 lrwxrwxrwx. 1 root root 16 Jan 30 10:16 net_cls -> net_cls,net_prio dr-xr-xr-x. 3 root root 0 Jan 30 10:16 net_cls,net_prio lrwxrwxrwx. 1 root root 16 Jan 30 10:16 net_prio -> net_cls,net_prio dr-xr-xr-x. 3 root root 0 Jan 30 10:16 perf_event dr-xr-xr-x. 6 root root 0 Jan 30 10:16 pids dr-xr-xr-x. 2 root root 0 Jan 30 10:16 rdma dr-xr-xr-x. 6 root root 0 Jan 30 10:16 systemd
$ sudo mount -t cgroup cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) 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) ...