Skip to content

Commit ddf8539

Browse files
committed
fix(cpu): fix generateBlockCPUSet process numa binding shared_cores containers block
Modify policy advisor to consider both isolation and NUMA-bound share pools when checking for NUMA binding
1 parent 7bc7e9e commit ddf8539

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

pkg/agent/qrm-plugins/commonstate/pool.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func IsSystemPool(poolName string) bool {
6464
return strings.HasPrefix(poolName, PoolNamePrefixSystem)
6565
}
6666

67+
func IsShareNUMABindingPool(poolName string) bool {
68+
return strings.Contains(poolName, NUMAPoolInfix)
69+
}
70+
6771
func GetPoolType(poolName string) string {
6872
if IsIsolationPool(poolName) {
6973
return PoolNamePrefixIsolation

pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy_advisor_handler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ func (p *DynamicPolicy) applyAllSubCgroupQuotaToUnLimit(containerRelativePath st
813813
// generateBlockCPUSet generates BlockCPUSet from cpu-advisor response.
814814
// The logic contains the following main steps:
815815
// 1. Handle blocks for static pools and forbidden pools
816-
// 2. Handle blocks with specified NUMA IDs (for NUMA-bound dedicated_cores containers
816+
// 2. Handle blocks with specified NUMA IDs (for NUMA-bound dedicated_cores/shared_cores containers
817817
// and reclaimed_cores containers colocated with them)
818818
// 3. Handle blocks without specified NUMA ID (for non-NUMA-bound containers including
819819
// dedicated_cores, shared_cores and reclaimed_cores containers)
@@ -973,9 +973,11 @@ func (p *DynamicPolicy) generateBlockCPUSet(resp *advisorapi.ListAndWatchRespons
973973
numaAvailableCPUs = numaAvailableCPUs.Difference(cpuset)
974974
availableCPUs = availableCPUs.Difference(cpuset)
975975

976-
_, ok = block.OwnerPoolEntryMap[commonstate.PoolNameShare]
977-
if ok {
978-
withNUMABindingShareOrDedicatedPod = true
976+
for poolName := range block.OwnerPoolEntryMap {
977+
if commonstate.IsIsolationPool(poolName) || commonstate.IsShareNUMABindingPool(poolName) {
978+
withNUMABindingShareOrDedicatedPod = true
979+
break
980+
}
979981
}
980982
}
981983

0 commit comments

Comments
 (0)