Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(advisor): fix advisor snb pool size calc #678

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ type ProvisionAssemblerCommon struct {
nonBindingNumas *machine.CPUSet
allowSharedCoresOverlapReclaimedCores *bool

metaReader metacache.MetaReader
metaServer *metaserver.MetaServer
emitter metrics.MetricEmitter
regionHelper *RegionMapHelper
metaReader metacache.MetaReader
metaServer *metaserver.MetaServer
emitter metrics.MetricEmitter
}

func NewProvisionAssemblerCommon(conf *config.Configuration, _ interface{}, regionMap *map[string]region.QoSRegion,
Expand All @@ -62,10 +61,9 @@ func NewProvisionAssemblerCommon(conf *config.Configuration, _ interface{}, regi
nonBindingNumas: nonBindingNumas,
allowSharedCoresOverlapReclaimedCores: allowSharedCoresOverlapReclaimedCores,

metaReader: metaReader,
metaServer: metaServer,
emitter: emitter,
regionHelper: NewRegionMap(*regionMap),
metaReader: metaReader,
metaServer: metaServer,
emitter: emitter,
}
}

Expand All @@ -90,6 +88,8 @@ func (pa *ProvisionAssemblerCommon) AssembleProvision() (types.InternalCPUCalcul
isolationUpperSizes := make(map[string]int)
isolationLowerSizes := make(map[string]int)

regionHelper := NewRegionMap(*pa.regionMap)

for _, r := range *pa.regionMap {
controlKnob, err := r.GetProvision()
if err != nil {
Expand All @@ -111,7 +111,7 @@ func (pa *ProvisionAssemblerCommon) AssembleProvision() (types.InternalCPUCalcul
}

// calc isolation pool size
isolationRegions := pa.regionHelper.GetRegions(regionNuma, configapi.QoSRegionTypeIsolation)
isolationRegions := regionHelper.GetRegions(regionNuma, configapi.QoSRegionTypeIsolation)

isolationRegionControlKnobs := map[string]types.ControlKnob{}
isolationRegionControlKnobKey := configapi.ControlKnobNonReclaimedCPURequirementUpper
Expand Down Expand Up @@ -169,15 +169,15 @@ func (pa *ProvisionAssemblerCommon) AssembleProvision() (types.InternalCPUCalcul
if r.IsNumaBinding() {
regionNuma := r.GetBindingNumas().ToSliceInt()[0] // always one binding numa for this type of region
// If there is a SNB pool with the same NUMA ID, it will be calculated while processing the SNB pool.
if shareRegions := pa.regionHelper.GetRegions(regionNuma, configapi.QoSRegionTypeShare); len(shareRegions) == 0 {
if shareRegions := regionHelper.GetRegions(regionNuma, configapi.QoSRegionTypeShare); len(shareRegions) == 0 {
calculationResult.SetPoolEntry(r.Name(), regionNuma, int(controlKnob[configapi.ControlKnobNonReclaimedCPURequirementUpper].Value))

_, ok := calculationResult.GetPoolEntry(state.PoolNameReclaim, regionNuma)
if !ok {
available := getNUMAsResource(*pa.numaAvailable, r.GetBindingNumas())
reservedForReclaim := getNUMAsResource(*pa.reservedForReclaim, r.GetBindingNumas())

isolationRegions := pa.regionHelper.GetRegions(regionNuma, configapi.QoSRegionTypeIsolation)
isolationRegions := regionHelper.GetRegions(regionNuma, configapi.QoSRegionTypeIsolation)
isolationSizes := 0
for _, ir := range isolationRegions {
ck, err := ir.GetProvision()
Expand Down
Loading