diff --git a/cmd/plugins/balloons/policy/balloons-policy.go b/cmd/plugins/balloons/policy/balloons-policy.go index 490d43fe3..a5e4415f3 100644 --- a/cmd/plugins/balloons/policy/balloons-policy.go +++ b/cmd/plugins/balloons/policy/balloons-policy.go @@ -39,7 +39,6 @@ const ( PolicyName = "balloons" // PolicyDescription is a short description of this policy. PolicyDescription = "Flexible pools with per-pool CPU parameters" - // balloonKey is a pod annotation key, the value is a pod balloon name. balloonKey = "balloon." + PolicyName + "." + kubernetes.ResmgrKeyNamespace // hideHyperthreadsKey is a pod annotation key for pod/container-specific hyperthread allowance. @@ -56,6 +55,12 @@ const ( // virtDevIsolatedCpus is the name of a virtual device close to // host isolated CPUs. virtDevIsolatedCpus = "isolated CPUs" + // virtDevECores is the name of a virtual device close to + // power efficient cores. + virtDevECores = "efficient cores" + // virtDevPCores is the name of a virtual device close to + // high performance cores. + virtDevPCores = "performance cores" ) // balloons contains configuration and runtime attributes of the balloons policy @@ -562,6 +567,8 @@ func (p *balloons) newBalloon(blnDef *BalloonDef, confCpus bool) (*Balloon, erro virtDevCpusets: map[string][]cpuset.CPUSet{ virtDevReservedCpus: {p.reserved}, virtDevIsolatedCpus: {p.options.System.Isolated()}, + virtDevECores: {p.cpuAllocator.GetCPUPriorities()[cpuallocator.PriorityLow]}, + virtDevPCores: {p.cpuAllocator.GetCPUPriorities()[cpuallocator.PriorityHigh]}, }, } if blnDef.AllocatorTopologyBalancing != nil { @@ -1202,6 +1209,12 @@ func (p *balloons) fillCloseToDevices(blnDefs []*BalloonDef) { if blnDef.PreferIsolCpus { blnDef.PreferCloseToDevices = append(blnDef.PreferCloseToDevices, virtDevIsolatedCpus) } + if blnDef.PreferCoreType == "performance" { + blnDef.PreferCloseToDevices = append(blnDef.PreferCloseToDevices, virtDevPCores) + } + if blnDef.PreferCoreType == "efficient" { + blnDef.PreferCloseToDevices = append(blnDef.PreferCloseToDevices, virtDevECores) + } } } diff --git a/config/crd/bases/config.nri_balloonspolicies.yaml b/config/crd/bases/config.nri_balloonspolicies.yaml index 6babf6d1c..16f1d3872 100644 --- a/config/crd/bases/config.nri_balloonspolicies.yaml +++ b/config/crd/bases/config.nri_balloonspolicies.yaml @@ -195,6 +195,14 @@ spec: items: type: string type: array + preferCoreType: + description: |- + preferCoreType: prefer performance or efficient (P/E) CPU cores on + hybrid architectures. + enum: + - efficient + - performance + type: string preferIsolCpus: default: false description: 'preferIsolCpus: prefer kernel isolated cpus' diff --git a/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml b/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml index 6babf6d1c..16f1d3872 100644 --- a/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml +++ b/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml @@ -195,6 +195,14 @@ spec: items: type: string type: array + preferCoreType: + description: |- + preferCoreType: prefer performance or efficient (P/E) CPU cores on + hybrid architectures. + enum: + - efficient + - performance + type: string preferIsolCpus: default: false description: 'preferIsolCpus: prefer kernel isolated cpus' diff --git a/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go b/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go index f5b73c17e..04b582e63 100644 --- a/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go +++ b/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go @@ -219,6 +219,11 @@ type BalloonDef struct { // preferIsolCpus: prefer kernel isolated cpus // +kubebuilder:default:=false PreferIsolCpus bool `json:"preferIsolCpus,omitempty"` + // preferCoreType: prefer performance or efficient (P/E) CPU cores on + // hybrid architectures. + // +optional + // +kubebuilder:validation:Enum:=efficient;performance + PreferCoreType string `json:"preferCoreType,omitempty"` } // String stringifies a BalloonDef