Skip to content

Commit

Permalink
fix(qrm): use max NUMA allocatable to calculate min-needed NUMAs (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
csfldf committed Jul 27, 2023
1 parent 085b466 commit c0539e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/agent/qrm-plugins/memory/dynamicpolicy/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,17 @@ func (nm NUMANodeMap) BytesPerNUMA() (uint64, error) {
return 0, fmt.Errorf("getBytesPerNUMAFromMachineState got nil numaMap")
}

var maxNUMAAllocatable uint64
for _, numaState := range nm {
if numaState != nil {
return numaState.Allocatable, nil
maxNUMAAllocatable = general.MaxUInt64(maxNUMAAllocatable, numaState.Allocatable)
}
}

if maxNUMAAllocatable > 0 {
return maxNUMAAllocatable, nil
}

return 0, fmt.Errorf("getBytesPerNUMAFromMachineState doesn't get valid numaState")
}

Expand Down

0 comments on commit c0539e3

Please sign in to comment.