Cgroup学习笔记4—相关DEBUG

一、相关DEBUG接口

1. cat /proc/mounts | grep cgroup 可以查看每个子系统挂载位置等信息

# cat /proc/mounts | grep cgroup
none /dev/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
none /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,memory_recursiveprot 0 0
none /dev/cpuctl cgroup rw,nosuid,nodev,noexec,relatime,cpu 0 0
none /dev/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset,noprefix,release_agent=/sbin/cpuset_release_agent 0 0
none /dev/memcg cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
none /dev/freezer cgroup rw,relatime,freezer 0 0

 

2. cgroup_debug 启动参数

Group的debug接口在 CONFIG_CGROUP_DEBUG 使能后打开,struct cgroup_subsys debug_cgrp_subsys 是个 __setup("cgroup_debug", enable_cgroup_debug);


3. cat /proc/pid/cgroup

# cat /proc/4128/cgroup
5:freezer:/
4:memory:/
3:cpuset:/restricted
2:cpu:/foreground
1:blkio:/
0::/uid_10179/pid_4128

前面的编号数字0 1 2 3 4 5 来自于每个 group 的 hierarchy_id:

cat /proc/<pid>/cgroup
    proc_cgroup_show //proc/fs/base.c struct pid_entry tgid_base_stuff[]
        list_for_each_entry((root), &cgroup_roots, root_list) {
            seq_printf(m, "%d:", root->hierarchy_id);    
        }

 

posted on 2023-03-06 11:29  Hello-World3  阅读(187)  评论(0编辑  收藏  举报

导航