@@ -79,13 +79,15 @@ type internalHeadroomPolicy struct {
79
79
}
80
80
81
81
type provisionPolicyResult struct {
82
+ msg string
82
83
essentials types.ResourceEssentials
83
84
regulatorOptions regulator.RegulatorOptions
84
85
controlKnobValueRegulators map [v1alpha1.ControlKnobName ]regulator.Regulator
85
86
}
86
87
87
- func newProvisionPolicyResult (essentials types.ResourceEssentials , regulatorOptions regulator.RegulatorOptions ) * provisionPolicyResult {
88
+ func newProvisionPolicyResult (essentials types.ResourceEssentials , regulatorOptions regulator.RegulatorOptions , msg string ) * provisionPolicyResult {
88
89
return & provisionPolicyResult {
90
+ msg : msg ,
89
91
essentials : essentials ,
90
92
regulatorOptions : regulatorOptions ,
91
93
controlKnobValueRegulators : make (map [v1alpha1.ControlKnobName ]regulator.Regulator ),
@@ -102,26 +104,20 @@ func (r *provisionPolicyResult) setEssentials(essentials types.ResourceEssential
102
104
103
105
// regulateControlKnob is to regulate control knob with current and last one
104
106
// todo: current only regulate control knob value, it will also regulate action in the future
105
- func (r * provisionPolicyResult ) regulateControlKnob (currentControlKnob types.ControlKnob , lastControlKnob * types.ControlKnob ) {
106
- if lastControlKnob != nil {
107
- for name , knob := range * lastControlKnob {
108
- reg , ok := r .controlKnobValueRegulators [name ]
109
- if ! ok || reg == nil {
110
- reg = r .newRegulator (name )
111
- }
112
-
113
- reg .SetLatestControlKnobValue (knob )
114
- r .controlKnobValueRegulators [name ] = reg
115
- }
116
- }
117
-
107
+ func (r * provisionPolicyResult ) regulateControlKnob (currentControlKnob , effectiveControlKnob types.ControlKnob ) {
108
+ klog .InfoS ("[provisionPolicyResult]" , "region" , r .msg ,
109
+ "currentControlKnob" , currentControlKnob , "effectiveControlKnob" , effectiveControlKnob )
118
110
for name , knob := range currentControlKnob {
119
111
reg , ok := r .controlKnobValueRegulators [name ]
120
112
if ! ok || reg == nil {
121
113
reg = r .newRegulator (name )
122
114
}
123
-
124
- reg .Regulate (knob )
115
+ effectiveKnobItem , ok := effectiveControlKnob [name ]
116
+ if ok {
117
+ reg .Regulate (knob , & effectiveKnobItem )
118
+ } else {
119
+ reg .Regulate (knob , nil )
120
+ }
125
121
r .controlKnobValueRegulators [name ] = reg
126
122
}
127
123
}
@@ -140,9 +136,9 @@ func (r *provisionPolicyResult) newRegulator(name v1alpha1.ControlKnobName) regu
140
136
// getControlKnob is to get final control knob from regulators
141
137
func (r * provisionPolicyResult ) getControlKnob () types.ControlKnob {
142
138
controlKnob := make (types.ControlKnob )
143
- for name , r := range r .controlKnobValueRegulators {
144
- controlKnob [name ] = types.ControlKnobValue {
145
- Value : float64 (r .GetRequirement ()),
139
+ for name , regulator := range r .controlKnobValueRegulators {
140
+ controlKnob [name ] = types.ControlKnobItem {
141
+ Value : float64 (regulator .GetRequirement ()),
146
142
Action : types .ControlKnobActionNone ,
147
143
}
148
144
}
@@ -230,6 +226,11 @@ func NewQoSRegionBase(name string, ownerPoolName string, regionType v1alpha1.QoS
230
226
MaxRampUpStep : conf .MaxRampUpStep ,
231
227
MaxRampDownStep : conf .MaxRampDownStep ,
232
228
MinRampDownPeriod : conf .MinRampDownPeriod ,
229
+ NeedHTAligned : func () bool {
230
+ return machine .SmtActive () &&
231
+ ! conf .GetDynamicConfiguration ().AllowSharedCoresOverlapReclaimedCores &&
232
+ regionType == v1alpha1 .QoSRegionTypeShare
233
+ },
233
234
},
234
235
235
236
metaReader : metaReader ,
@@ -289,6 +290,16 @@ func (r *QoSRegionBase) Clear() {
289
290
r .containerTopologyAwareAssignment = make (types.TopologyAwareAssignment )
290
291
}
291
292
293
+ func (r * QoSRegionBase ) GetMetaInfo () string {
294
+ r .Lock ()
295
+ defer r .Unlock ()
296
+ return r .getMetaInfo ()
297
+ }
298
+
299
+ func (r * QoSRegionBase ) getMetaInfo () string {
300
+ return fmt .Sprintf ("[regionName: %s, regionType: %s, ownerPoolName: %s, NUMAs: %v]" , r .name , r .regionType , r .ownerPoolName , r .bindingNumas .String ())
301
+ }
302
+
292
303
func (r * QoSRegionBase ) GetBindingNumas () machine.CPUSet {
293
304
r .Lock ()
294
305
defer r .Unlock ()
@@ -626,7 +637,7 @@ func (r *QoSRegionBase) getProvisionControlKnob() map[types.CPUProvisionPolicyNa
626
637
{Key : metricTagKeyControlKnobAction , Val : string (value .Action )},
627
638
}... )
628
639
629
- klog .InfoS ("[qosaware-cpu] get raw control knob" , "region " , r .name , "policy" , internal .name ,
640
+ klog .InfoS ("[qosaware-cpu] get raw control knob" , "meta " , r .getMetaInfo () , "policy" , internal .name ,
630
641
"knob" , name , "action" , value .Action , "value" , value .Value )
631
642
}
632
643
}
@@ -636,7 +647,7 @@ func (r *QoSRegionBase) getProvisionControlKnob() map[types.CPUProvisionPolicyNa
636
647
637
648
// regulateProvisionControlKnob regulate provision control knob for each provision policy
638
649
func (r * QoSRegionBase ) regulateProvisionControlKnob (originControlKnob map [types.CPUProvisionPolicyName ]types.ControlKnob ,
639
- lastControlKnob * types.ControlKnob ,
650
+ effectiveControlKnob types.ControlKnob ,
640
651
) {
641
652
provisionPolicyResults := make (map [types.CPUProvisionPolicyName ]* provisionPolicyResult )
642
653
firstValidPolicy := types .CPUProvisionPolicyNone
@@ -660,13 +671,13 @@ func (r *QoSRegionBase) regulateProvisionControlKnob(originControlKnob map[types
660
671
661
672
policyResult , ok := r .provisionPolicyResults [internal .name ]
662
673
if ! ok || policyResult == nil {
663
- policyResult = newProvisionPolicyResult (r .ResourceEssentials , r .cpuRegulatorOptions )
664
- policyResult .regulateControlKnob (controlKnob , lastControlKnob )
674
+ policyResult = newProvisionPolicyResult (r .ResourceEssentials , r .cpuRegulatorOptions , r . getMetaInfo () )
675
+ policyResult .regulateControlKnob (controlKnob , effectiveControlKnob )
665
676
} else {
666
677
policyResult .setEssentials (r .ResourceEssentials )
667
678
// only set regulator last cpu requirement for first valid policy
668
679
if internal .name == firstValidPolicy {
669
- policyResult .regulateControlKnob (controlKnob , lastControlKnob )
680
+ policyResult .regulateControlKnob (controlKnob , effectiveControlKnob )
670
681
} else {
671
682
policyResult .regulateControlKnob (controlKnob , nil )
672
683
}
@@ -685,8 +696,8 @@ func (r *QoSRegionBase) regulateProvisionControlKnob(originControlKnob map[types
685
696
{Key : metricTagKeyControlKnobName , Val : string (knob )},
686
697
{Key : metricTagKeyControlKnobAction , Val : string (value .Action )},
687
698
}... )
688
- klog .InfoS ("[qosaware-cpu] get regulated control knob" , "region" , r .name , "policy " , policy , "knob" , knob ,
689
- "action" , value .Action , "value" , value .Value )
699
+ klog .InfoS ("[qosaware-cpu] get regulated control knob" , "region" , r .name , "bindingNumas " , r . bindingNumas . String () ,
700
+ "policy" , policy , "knob" , knob , " action" , value .Action , "value" , value .Value )
690
701
}
691
702
}
692
703
}
0 commit comments