- Product Bulletin
- Service Overview
-
User Guide
- Usage Overview
- Selecting HCE as the Public Image When Creating an ECS
- Changing an OS to HCE
- Migrating an OS
- Upgrading HCE and RPM Packages
- Security Updates for HCE
- Obtaining the openEuler Extended Software Packages
- Creating a Docker Image and Starting a Container
- Tools
- Kernel Functions and Interfaces
- xGPU
- Configuring the Repositories and Installing Software for HCE
-
FAQs
- What Do I Do If CentOS Linux Is No Longer Maintained?
- Does Huawei Cloud Have a Migration Solution for CentOS?
- How Do I Install the MLNX Driver?
- How Do I Enable SELinux on an ECS Running HCE?
- How Do I Change the OS Name on the Console After the OS Is Migrated?
- How Are Huawei Cloud EulerOS, EulerOS, and openEuler Different from One Another?
- How Do I Enable WireGuard in Kernel and Install wireguard-tools?
- How Do I Save the User Credential Information for Logging In to Docker Like What Docker CE Does?
- What Is OOM? Why Does OOM Occur?
- How Do I Handle IPVS Errors?
- Why Can't HCE Obtain an IPv6 Address After IPv6 Is Enabled for an ECS?
- How Do I Set Auto Log Using TMOUT?
- Best Practices
- General Reference
Copied.
Multi-level Hybrid Scheduling of Kernel CPU cgroups
Background
In hybrid deployments, the Linux kernel scheduler assigns more scheduling opportunities to high-priority tasks and minimizes the impact of low-priority tasks on kernel scheduling. However, the two-level scheduling of online and offline services cannot meet this requirement.
To solve the problem, HCE 2.0 allows multi-level scheduling of kernel CPU cgroups and provides the interface /sys/fs/cgroup/cpu/cpu.qos_level to extend the scheduling levels from two to five, allowing users to set the priority for each cgroup separately.
Constraints
Multi-level hybrid scheduling of the kernel CPU cgroups is developed based on the 5.10.0-60.18.0.50.r692_16.hce2.x86_64 kernel. cpu.qos_level supports only cgroup v1.
Interface Description
Rules for cpu.qos_level to take effect:
- Completely Fair Scheduler (CFS) selects task_group level by level from top to bottom. cpu.qos_level takes effect for child cgroups under the same parent cgroup.
- When a child cgroup is created, it inherits the cpu.qos_level value of the parent cgroup by default, but the cpu.qos_level value can be reconfigured.
- For QoS levels with the same priority, their resource competition complies with the policy of CFS.
- On the same CPU, the tasks whose qos_level is less than 0 are always unconditionally preempted by tasks whose qos_level is greater than or equal to is 0, regardless of their levels.
When a high-priority task is scheduled:
- Online tasks can unconditionally preempt the CPU resources of offline tasks. During multi-core scheduling, online tasks can preferentially preempt the CPU resources of offline tasks on other cores. In the hyper-thread scenario, online tasks with priority 2 can evict offline tasks on the SMT.
- When a task with a higher priority is woken up, the task is accelerated by time slicing and can immediately preempt the CPU resources of the task with a lower priority to obtain a response at a lower latency (the minimum running time slice of CFS is ignored).
Interface Configuration Example
Create cgroups A, B, and C, and configure the cpu.qos_level interface.
cgroup |
cpu.qos_level Value |
---|---|
A |
1 |
B |
-2 |
C |
2 |
- Create cgroup A and child cgroups B and C, and set their CPU scheduling priorities to 1, -2, and 2.
Tasks in cgroups A and C can unconditionally preempt CPU resources of the tasks in cgroup B. cgroup C preferentially preempts CPU resources because the priority of cgroup C is higher than that of cgroup A.
mkdir -p /sys/fs/cgroup/cpu/A echo 1 > /sys/fs/cgroup/cpu/A/cpu.qos_level mkdir -p /sys/fs/cgroup/cpu/A/B echo -2 > /sys/fs/cgroup/cpu/A/B/cpu.qos_level mkdir -p /sys/fs/cgroup/cpu/A/C echo 2 > /sys/fs/cgroup/cpu/A/C/cpu.qos_level
- Add the task1, task2, and task3 processes to cgroup B.
- Add the task4 and task5 processes to cgroup C.
- View the CPU scheduling priority and processes of cgroup B.
[root@localhost cpu_qos]# cat /sys/fs/cgroup/cpu/A/B/cpu.qos_level -2 [root@localhost boot]# cat /sys/fs/cgroup/cpu/A/B/tasks 1879 1880 1881
- View the CPU scheduling priority and processes of cgroup C.
[root@localhost cpu_qos]# cat /sys/fs/cgroup/cpu/A/C/cpu.qos_level 2 [root@localhost boot]# cat /sys/fs/cgroup/cpu/A/C/tasks 1882 1883
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot