Translated message

A translation of this page exists in English.

RHEL 8에서 cgroup v2의 cpu 컨트롤러를 사용할 수 없는 문제

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 8

Issue

  • 부팅 파라미터 systemd.unified_cgroup_hierarchy=1을 사용하여 RHEL 8에서 cgroup v2를 활성화하였고, 일부 컨트롤러를 비특권(non-privileged) 사용자에게 위임하고자 하였습니다.

  • 대부분의 컨트롤러는 정상적으로 작동했지만, cpu 컨트롤러는 정상적으로 작동하지 않았습니다.

  • 수동으로 cpu 컨트롤러를 추가하는 것도 불가능합니다.

  • CPU 컨트롤러를 활성화하려고 할 때, 다음과 같은 오류가 발생합니다:

    # echo +cpu > /sys/fs/cgroup/cgroup.subtree_control
    -bash: echo: write error: Invalid argument
    

Resolution

  • cgroup v2에서 실시간(Real Time) 비커널 스레드 프로세스가 존재하면, CPU 컨트롤러는 마운트되지 않습니다.

  • CPU 컨트롤러를 사용하려면, 실시간 스케줄링 정책으로 동작 중인 애플리케이션을 중지해야 합니다.

Root Cause

  • 일부 애플리케이션은 실시간 우선순위로 동작하며, 이로 인해 해당 문제가 발생할 수 있습니다.

    필요하지 않은 경우, 이러한 애플리케이션은 비활성화할 수 있습니다.

  • 아래는 실시간 스케줄링 정책으로 실행되어 문제를 유발할 수 있는 애플리케이션의 예시 목록입니다.(완전한 목록은 아님):

Diagnostic Steps

  • 실시간 스케줄링(Real Time Scheduling)으로 실행 중인 프로세스가 있는지 확인
         r8 # chrt -r 40 sleep 5000 &  # example sleep process running in real time
         r8 # ps axo pid,cls,cmd | awk '$2 ~ /(FF|RR)/' | grep -v '[[]'
           1831  RR sleep 5000

         r8 # echo +cpu > cgroup.subtree_control 
        -bash: echo: write error: Invalid argument
  • 또는, SCHED_RR (Round Robin 실시간 스케줄링 클래스) 을 사용하는 프로세스를 다음 명령어로 확인할 수 있습니다.

  • 예시에서는 timekeeper가 실시간 스케줄링 정책(RR)으로 실행되고 있으며, cpu 컨트롤러를 수동으로 추가하려면 해당 프로세스를 중지하거나 종료해야 합니다.

        $ ps -T axo pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroup,cls|grep RR
        1 895    1870 root     root    1936   15 Jan09 tk_status_file  0::/system.slice/timekeeper  RR

        $ ps -fe | grep 1895
        root        1895    1870  0 Jan09 ?        00:02:42 /opt/timekeeper/release64/timekeeperapp                             

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments