3.12. Common Tunable Parameters


The following parameters are present in every created cgroup, regardless of the subsystem that the cgroup is using:
tasks
contains a list of processes, represented by their PIDs, that are running in a cgroup. The list of PIDs is not guaranteed to be ordered or unique (that is, it may contain duplicate entries). Writing a PID into the tasks file of a cgroup moves that process into that cgroup.
cgroup.procs
contains a list of thread groups, represented by their TGIDs, that are running in a cgroup. The list of TGIDs is not guaranteed to be ordered or unique (that is, it may contain duplicate entries). Writing a TGID into the cgroup.procs file of a cgroup moves that thread group into that cgroup.
cgroup.event_control
along with the cgroup notification API, allows notifications to be sent about a changing status of a cgroup.
notify_on_release
contains a Boolean value, 1 or 0, that either enables or disables the execution of the release agent. If the notify_on_release parameter is enabled, the kernel executes the contents of the release_agent file when a cgroup no longer contains any tasks (that is, the cgroup's tasks file contained some PIDs and those PIDs were removed, leaving the file empty). A path to the empty cgroup is provided as an argument to the release agent.
The default value of the notify_on_release parameter in the root cgroup is 0. All non-root cgroups inherit the value in notify_on_release from their parent cgroup.
release_agent (present in the root cgroup only)
contains a command to be executed when a notify on release is triggered. Once a cgroup is emptied of all processes, and the notify_on_release flag is enabled, the kernel runs the command in the release_agent file and supplies it with a relative path (relative to the root cgroup) to the emptied cgroup as an argument. The release agent can be used, for example, to automatically remove empty cgroups; for more information, see Example 3.4, “Automatically removing empty cgroups”.

Example 3.4. Automatically removing empty cgroups

Follow these steps to configure automatic removal of any emptied cgroup from the cpu cgroup:
  1. Create a shell script that removes empty cpu cgroups, place it in, for example, /usr/local/bin, and make it executable.
    ~]# cat /usr/local/bin/remove-empty-cpu-cgroup.sh
    #!/bin/sh
    rmdir /cgroup/cpu/$1
    ~]# chmod +x /usr/local/bin/remove-empty-cpu-cgroup.sh
    Copy to Clipboard Toggle word wrap
    The $1 variable contains a relative path to the emptied cgroup.
  2. In the cpu cgroup, enable the notify_on_release flag:
    ~]# echo 1 > /cgroup/cpu/notify_on_release
    Copy to Clipboard Toggle word wrap
  3. In the cpu cgroup, specify a release agent to be used:
    ~]# echo "/usr/local/bin/remove-empty-cpu-cgroup.sh" > /cgroup/cpu/release_agent
    Copy to Clipboard Toggle word wrap
  4. Test your configuration to make sure emptied cgroups are properly removed:
    cpu]# pwd; ls
    /cgroup/cpu
    cgroup.event_control  cgroup.procs  cpu.cfs_period_us  cpu.cfs_quota_us  cpu.rt_period_us  cpu.rt_runtime_us  cpu.shares  cpu.stat  libvirt  notify_on_release  release_agent  tasks
    cpu]# cat notify_on_release 
    1
    cpu]# cat release_agent 
    /usr/local/bin/remove-empty-cpu-cgroup.sh
    cpu]# mkdir blue; ls
    blue  cgroup.event_control  cgroup.procs  cpu.cfs_period_us  cpu.cfs_quota_us  cpu.rt_period_us  cpu.rt_runtime_us  cpu.shares  cpu.stat  libvirt  notify_on_release  release_agent  tasks
    cpu]# cat blue/notify_on_release 
    1
    cpu]# cgexec -g cpu:blue dd if=/dev/zero of=/dev/null bs=1024k &
    [1] 8623
    cpu]# cat blue/tasks 
    8623
    cpu]# kill -9 8623
    cpu]# ls
    cgroup.event_control  cgroup.procs  cpu.cfs_period_us  cpu.cfs_quota_us  cpu.rt_period_us  cpu.rt_runtime_us  cpu.shares  cpu.stat  libvirt  notify_on_release  release_agent  tasks
    
    Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat