Skip to content

Commit

Permalink
fix(qrm): make ramp up cpus not overlapping with cpus in NUMAs contai…
Browse files Browse the repository at this point in the history
…ning NUMA_binding pods
  • Loading branch information
csfldf committed Jun 20, 2024
1 parent aec50da commit 9e6f2fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,12 @@ func (p *DynamicPolicy) applyBlocks(blockCPUSet advisorapi.BlockCPUSet, resp *ad
return fmt.Errorf("GetSharedBindingNUMAs failed with error: %v", err)
}
sharedBindingNUMACPUs := p.machineInfo.CPUDetails.CPUsInNUMANodes(sharedBindingNUMAs.UnsortedList()...)
// rampUpCPUs include reclaim pool
// rampUpCPUs include reclaim pool in NUMAs without NUMA_binding cpus
rampUpCPUs := p.machineInfo.CPUDetails.CPUs().
Difference(p.reservedCPUs).
Difference(dedicatedCPUSet).
Difference(sharedBindingNUMACPUs).
Union(newEntries[state.PoolNameReclaim][state.FakedContainerName].AllocationResult)
Difference(sharedBindingNUMACPUs)

rampUpCPUsTopologyAwareAssignments, err := machine.GetNumaAwareAssignments(p.machineInfo.CPUTopology, rampUpCPUs)
if err != nil {
return fmt.Errorf("unable to calculate topologyAwareAssignments for rampUpCPUs, result cpuset: %s, error: %v",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ func (p *DynamicPolicy) sharedCoresWithoutNUMABindingAllocationHandler(_ context

machineState := p.state.GetMachineState()
pooledCPUs := machineState.GetFilteredAvailableCPUSet(p.reservedCPUs,
func(ai *state.AllocationInfo) bool {
return state.CheckDedicated(ai) || state.CheckNUMABinding(ai)
}, state.CheckDedicatedNUMABinding)
state.CheckDedicated, state.CheckNUMABinding)

if pooledCPUs.IsEmpty() {
general.Errorf("pod: %s/%s, container: %s get empty pooledCPUs", req.PodNamespace, req.PodName, req.ContainerName)
Expand Down Expand Up @@ -880,12 +878,11 @@ func (p *DynamicPolicy) applyPoolsAndIsolatedInfo(poolsCPUSet map[string]machine
}

sharedBindingNUMACPUs := p.machineInfo.CPUDetails.CPUsInNUMANodes(sharedBindingNUMAs.UnsortedList()...)
// rampUpCPUs include reclaim pool
// rampUpCPUs include reclaim pool in NUMAs without NUMA_binding cpus
rampUpCPUs := machineState.GetFilteredAvailableCPUSet(p.reservedCPUs,
nil, state.CheckDedicatedNUMABinding).
Difference(unionDedicatedIsolatedCPUSet).
Difference(sharedBindingNUMACPUs).
Union(poolsCPUSet[state.PoolNameReclaim])
Difference(sharedBindingNUMACPUs)

rampUpCPUsTopologyAwareAssignments, err := machine.GetNumaAwareAssignments(p.machineInfo.CPUTopology, rampUpCPUs)
if err != nil {
Expand Down

0 comments on commit 9e6f2fe

Please sign in to comment.