Colocation scheduling enhancements on Alibaba Cloud Linux 4 (Group Identity 2.0)
Group Identity 2.0 is the colocation scheduling capability of Alibaba Cloud Linux 4 (Alinux 4). It combines the EEVDF scheduler, core scheduling, and sched_idle semantics to raise overall CPU utilization while protecting the quality of service (QoS) of high-priority workloads.
Prerequisites
Group Identity 2.0 applies only to specific Alinux 4 environments. Confirm the following before you enable colocation scheduling:
Instance architecture — The
CONFIG_GROUP_IDENTITYcompile-time option controls whether the capability is integrated into the kernel. It is enabled on x86 and disabled on all other architectures, so Group Identity 2.0 is not available on non-x86 instances. On x86 instances, no compile-time action is required.Kernel and Group Identity version — Alinux 4 is based on the Linux 6.6 LTS kernel. Group Identity 1.0 was developed on the 5.10 kernel, and Group Identity 2.0 is developed on the 6.6 kernel.
To confirm that the running kernel supports Group Identity 2.0, run the following command:
cat /sys/kernel/group_identity/abiIf the file exists and returns 2, the kernel supports Group Identity 2.0. If the file does not exist or returns any other value, Group Identity 2.0 is not supported. The /sys/kernel/group_identity/abi file does not exist on the 5.10 kernel.
Group Identity 2.0 upgrades over Alinux 3
Alibaba Cloud Linux 3 (Alinux 3) provides Group Identity 1.0, which relies on a custom expelling mechanism built on dual red-black trees and on inter-processor interrupt (IPI) coordination. Group Identity 2.0 rebuilds that mechanism on EEVDF, core scheduling, and sched_idle, and provides separate protection paths for CPU contention and for SMT interference. The following table compares the two versions across five technical areas.
| Technical area | Alinux 3 (Group Identity 1.0) | Alinux 4 (Group Identity 2.0) | Value |
| Scheduling queue model | Distinguishes high-priority (online) tasks from low-priority (offline) tasks by using dual red-black trees, and supports per-cgroup identity and BVT-compatible configuration. | Integrates the EEVDF scheduling model, and handles workload tiering and low-priority task yielding within a unified fair scheduling framework. | Scheduling behavior is closer to the mainline mechanisms of the 6.6 kernel, which improves fairness and maintainability. |
| Expelling and isolation mechanism | When a high-priority task is triggered, expel checks and reschedule IPI signals make low-priority tasks on sibling SMT threads yield the CPU. | Models the expeller and the expellee based on core scheduling cookies, and combines expel checks on the pick path to isolate contention within the same SMT core more precisely. | Reduces hyper-threading interference from low-priority tasks on high-priority tasks, which lowers tail latency and jitter for high-priority workloads. |
| Preemption semantics | Expels tasks by priority through custom policies such as high/underclass, absolute expel, and idle seeker/idle saver. | Uses the three-state tiering of cpu.priority. Low-priority tasks reuse sched_idle semantics: they yield the CPU when resources are constrained and keep running when resources are idle. | Workload priorities are expressed explicitly, which makes it easier to balance high-priority protection against low-priority resource utilization. |
| Low-priority task relocation | Supports expellee migration, rescue, ID_LOAD_BALANCE, and ID_BOOK_CPU, which prevents long-term expelling of low-priority tasks. | Enhances push, rescue, and fallback behavior for low-priority tasks, which reduces ineffective migrations and long-term starvation after expelling. | Protects high-priority workloads during peak hours and keeps using idle CPU resources during off-peak hours. |
| Production controllability | Provides sysctl switches, force disable, fast path, and stop_machine switching, together with multiple counter and vruntime corrections. | Keeps the compatible interfaces and enhances statistics, tuning, and boundary fixes. | Existing Group Identity 1.0 configurations remain valid, and individual switches can be enabled or disabled at runtime. |
Enable colocation scheduling
To avoid kernel version divergence, Group Identity 2.0 is merged into the kernel at compile time and enabled dynamically at runtime. All runtime switches are written to /sys/kernel/debug/sched/features. Enable a switch by writing its name to that file, and disable it by writing the same name with the NO_ prefix:
echo <switch-name> > /sys/kernel/debug/sched/features
echo NO_<switch-name> > /sys/kernel/debug/sched/featuresReplace <switch-name> with the name of the switch, such as ID_LOAD_BALANCE.
Enable the required switches
Two switches must be enabled before colocation scheduling takes effect. Both are disabled by default.
Enable the scheduling preemption policy.
GROUP_IDENTITY_PREEMPTcontrols the scheduling preemption policy of Group Identity 2.0.echo GROUP_IDENTITY_PREEMPT > /sys/kernel/debug/sched/featuresEnable the SMT expelling policy.
ID_SMT_EXPELlets a high-priority task, called the expeller, expel low-priority tasks that run on the other SMT threads of the same core. Those tasks then no longer contend with the expeller for hyper-threading execution units.echo ID_SMT_EXPEL > /sys/kernel/debug/sched/featuresVerify that both switches are enabled.
cat /sys/kernel/debug/sched/featuresEvery switch that you enabled appears in the output. For example, if
GROUP_IDENTITY_PREEMPTappears in the output, the scheduling preemption policy is enabled.
Tune the optional switches
The following switches tune expelling and load balancing behavior. They are not required for colocation scheduling to take effect.
| Switch | Policy | Default | Recommendation | Behavior |
ID_EXPELLER_SHARE_CORE | SMT expelling | Enabled | (Recommended) Disable | Allows expellers to share SMT threads. Colocation requires high-priority tasks to be spread out as much as possible, so disabling this switch minimizes SMT interference between high-priority tasks. |
ID_EXPELLEE_NEVER_HOT | SMT expelling | Disabled | (Recommended) Enable | Low-priority tasks ignore cache hotness and do not take cache warmth into account during migration. |
ID_RESCUE_EXPELLEE | SMT expelling | Disabled | (Recommended) Enable | Rescues low-priority tasks after they are expelled, which keeps them from starving. |
ID_PUSH_EXPELLEE | SMT expelling | Disabled | (Recommended) Enable | Pushes a low-priority task to another CPU after SMT expelling, which reduces the continuous impact of that task on the expeller on the local core. |
ID_ABSOLUTE_EXPEL | SMT expelling | Disabled | (Recommended) Enable | While high-priority tasks exist, low-priority tasks are not allowed to run at all. |
ID_LOAD_BALANCE | Load balancing | Disabled | (Recommended) Enable | Performs dedicated load balancing for high-priority tasks, which prevents the CPU scheduling latency caused by high-priority tasks piling up on a small number of CPU cores. |
ID_ABSOLUTE_EXPEL gives high-priority tasks absolute precedence, which means low-priority tasks stop running entirely while high-priority tasks exist. Enable ID_RESCUE_EXPELLEE and ID_PUSH_EXPELLEE together with it to keep low-priority tasks from starving.
Configure preemption priority (cpu.priority)
Use the cpu.priority interface to configure the preemption capability of the tasks in a cgroup. The following table describes the valid values.
| Value | Task type | Remarks |
1 | High-priority task | cpu.idle = 0 is set at the same time. |
0 | Normal task | cpu.idle = 0 is set at the same time. |
-1 | Low-priority task | cpu.idle = 1 is set at the same time. |
The following rules apply to cpu.priority:
Unified priority semantics — Set the priority through
cpu.priorityinstead of settingcpu.idleseparately. The matchingcpu.idlevalue is set at the same time.Valid values — Only
1,0, and-1are accepted. Other values are rejected.Root cgroup — The root cgroup cannot be configured.
Hierarchy — Cgroups at each level can be configured separately, but they are compared under their common ancestor. For example, two paths lead down from the root node:
A->BandA->C->D. When B and D compete, A is the lowest common ancestor, so the actual competition takes place between B and C, where C represents D.Default shares — The default shares value of
cpu.idleis 3. To change this value, the kernel switchsysctl_sched_idle_shares_relaxmust be set to1.
Configure SMT expelling (cpu.identity)
Use the cpu.identity interface to configure the SMT expelling capability of the tasks in a cgroup. SMT expelling takes effect only when ID_SMT_EXPEL is enabled. For instructions, see Enable colocation scheduling. The following table describes the valid values.
| Value | Task type | Remarks |
1 | High-priority task (expeller) | Expels tasks whose identity is -1 on the peer SMT thread. |
0 | Normal task | |
-1 | Low-priority task (expellee) | Is expelled by tasks whose identity is 1 on the peer SMT thread. |
The following rules apply to cpu.identity:
Underlying implementation — The kernel creates two different cookies for the tasks that carry the two identity values.
Required switch — Enable
ID_SMT_EXPELto let high-priority tasks continuously expel low-priority tasks from SMT threads. In this case, also enableID_RESCUE_EXPELLEEandID_PUSH_EXPELLEEto keep low-priority tasks from starving.Interference between high-priority tasks — Disabling
ID_EXPELLER_SHARE_COREminimizes SMT interference between high-priority tasks. This matters most when your high-priority tasks are especially sensitive to SMT interference.Valid values — Only
1,0, and-1are accepted. Other values are rejected.Root cgroup — The root cgroup cannot be configured.
Scope — The setting takes effect only on the tasks in the current cgroup. When cgroups at multiple levels have the same identity value, the setting is neither controlled by the cgroup ancestors nor applied to the cgroup descendants. Set the value only on leaf nodes to avoid ambiguity.
Inheritance — When a child cgroup is created, it inherits the identity of its parent cgroup.
Migrate from Group Identity 1.0
Compared with the 5.10 kernel, the semantics of the cpu.identity interface have changed as a whole. Group Identity 2.0 splits the interface into cpu.priority for the preemption capability and cpu.identity for the SMT expelling capability. The cpu.bvt_warp_ns interface remains compatible. The following table maps each Group Identity 1.0 cpu.bvt_warp_ns configuration to its Group Identity 2.0 equivalent.
| Task type | cpu.priority (preemption capability) | cpu.identity (SMT expelling capability) | 5.10 Group Identity 1.0 configuration | Configuration notes |
| High-priority task | 1 | 1 | cpu.bvt_warp_ns = 2 | Has the preemption capability, and can expel low-priority tasks on SMT threads. |
| High-priority task, preemption only | 1 | 0 | cpu.bvt_warp_ns = 1 | Has the same preemption capability as a high-priority task, but does not expel low-priority tasks on SMT threads. |
| Normal task | 0 | 0 | cpu.bvt_warp_ns = 0 | Uses the default configurations and does not take part in special scheduling policies. |
| Low-priority task | -1 | -1 | cpu.bvt_warp_ns = -1 | Has a reduced preemption capability and can be expelled from SMT threads. This type applies to background tasks or tasks with low sensitivity. |
This topic uses cpu.bvt_warp_ns only to map Group Identity 1.0 configurations to their Group Identity 2.0 equivalents. On Alinux 4, configure tasks through cpu.priority and cpu.identity.