diff --git a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy.go b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy.go index 802916eae..bf200b110 100644 --- a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy.go +++ b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy.go @@ -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, diff --git a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_advisor_handler.go b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_advisor_handler.go index 4be9af060..6b2d1d091 100644 --- a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_advisor_handler.go +++ b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_advisor_handler.go @@ -383,7 +383,7 @@ func (p *DynamicPolicy) pushMemoryAdvisor() error { return nil } -func handleAdvisorCPUSetMems( +func (p *DynamicPolicy) handleAdvisorCPUSetMems( _ *config.Configuration, _ interface{}, _ *dynamicconfig.DynamicAgentConfiguration, @@ -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{ diff --git a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_test.go b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_test.go index 7cd3485ac..8d6bcb65c 100644 --- a/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_test.go +++ b/pkg/agent/qrm-plugins/memory/dynamicpolicy/policy_test.go @@ -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,