Skip to content

Commit

Permalink
Merge pull request #733 from luomingmeng/dev/fix-reclaimed-cores-memo…
Browse files Browse the repository at this point in the history
…ry-migrate

chore(qrm): support migrate pages in handleAdvisorCPUSetMems
  • Loading branch information
luomingmeng authored Dec 4, 2024
2 parents 5e4c267 + 4742e30 commit 9158323
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/agent/qrm-plugins/memory/dynamicpolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func NewDynamicPolicy(agentCtx *agent.GenericContext, conf *config.Configuration
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobKeyMemoryLimitInBytes,
memoryadvisor.ControlKnobHandlerWithChecker(policyImplement.handleAdvisorMemoryLimitInBytes))
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobKeyCPUSetMems,
memoryadvisor.ControlKnobHandlerWithChecker(handleAdvisorCPUSetMems))
memoryadvisor.ControlKnobHandlerWithChecker(policyImplement.handleAdvisorCPUSetMems))
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobKeyDropCache,
memoryadvisor.ControlKnobHandlerWithChecker(policyImplement.handleAdvisorDropCache))
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobReclaimedMemorySize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (p *DynamicPolicy) pushMemoryAdvisor() error {
return nil
}

func handleAdvisorCPUSetMems(
func (p *DynamicPolicy) handleAdvisorCPUSetMems(
_ *config.Configuration,
_ interface{},
_ *dynamicconfig.DynamicAgentConfiguration,
Expand Down Expand Up @@ -411,8 +411,12 @@ func handleAdvisorCPUSetMems(
apiconsts.PodAnnotationQoSLevelReclaimedCores)
}

allocationInfo.NumaAllocationResult = cpusetMems
allocationInfo.TopologyAwareAllocations = nil
numaSetChangedContainers := make(map[string]map[string]*state.AllocationInfo)
p.updateNUMASetChangedContainers(numaSetChangedContainers, allocationInfo, cpusetMems)
err = p.migratePagesForNUMASetChangedContainers(numaSetChangedContainers)
if err != nil {
return fmt.Errorf("migratePagesForNUMASetChangedContainers failed with error: %v", err)
}

_ = emitter.StoreInt64(util.MetricNameMemoryHandleAdvisorCPUSetMems, 1,
metrics.MetricTypeNameRaw, metrics.ConvertMapToTags(map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,7 @@ func TestHandleAdvisorResp(t *testing.T) {
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobKeyMemoryLimitInBytes,
memoryadvisor.ControlKnobHandlerWithChecker(dynamicPolicy.handleAdvisorMemoryLimitInBytes))
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobKeyCPUSetMems,
memoryadvisor.ControlKnobHandlerWithChecker(handleAdvisorCPUSetMems))
memoryadvisor.ControlKnobHandlerWithChecker(dynamicPolicy.handleAdvisorCPUSetMems))
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnobKeyDropCache,
memoryadvisor.ControlKnobHandlerWithChecker(dynamicPolicy.handleAdvisorDropCache))
memoryadvisor.RegisterControlKnobHandler(memoryadvisor.ControlKnowKeyMemoryOffloading,
Expand Down

0 comments on commit 9158323

Please sign in to comment.