@@ -33,6 +33,7 @@ const (
33
33
DistributeCPUsAcrossNUMAOption string = "distribute-cpus-across-numa"
34
34
AlignBySocketOption string = "align-by-socket"
35
35
DistributeCPUsAcrossCoresOption string = "distribute-cpus-across-cores"
36
+ AlignByUnCoreCacheOption string = "align-cpus-by-uncorecache"
36
37
)
37
38
38
39
var (
43
44
)
44
45
betaOptions = sets .New [string ](
45
46
FullPCPUsOnlyOption ,
47
+ AlignByUnCoreCacheOption ,
46
48
)
47
49
stableOptions = sets .New [string ]()
48
50
)
@@ -86,6 +88,9 @@ type StaticPolicyOptions struct {
86
88
// cpus (HT) on different physical core.
87
89
// This is a preferred policy so do not throw error if they have to packed in one physical core.
88
90
DistributeCPUsAcrossCores bool
91
+ // Flag that makes best-effort to align CPUs to a L3 or uncorecache boundary
92
+ // As long as there are CPUs available, pods will be admitted if the condition is not met.
93
+ AlignByUnCoreCacheOption bool
89
94
}
90
95
91
96
// NewStaticPolicyOptions creates a StaticPolicyOptions struct from the user configuration.
@@ -121,7 +126,12 @@ func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOption
121
126
return opts , fmt .Errorf ("bad value for option %q: %w" , name , err )
122
127
}
123
128
opts .DistributeCPUsAcrossCores = optValue
124
-
129
+ case AlignByUnCoreCacheOption :
130
+ optValue , err := strconv .ParseBool (value )
131
+ if err != nil {
132
+ return opts , fmt .Errorf ("bad value for option %q: %w" , name , err )
133
+ }
134
+ opts .AlignByUnCoreCacheOption = optValue
125
135
default :
126
136
// this should never be reached, we already detect unknown options,
127
137
// but we keep it as further safety.
@@ -138,6 +148,10 @@ func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOption
138
148
return opts , fmt .Errorf ("static policy options %s and %s can not be used at the same time" , DistributeCPUsAcrossNUMAOption , DistributeCPUsAcrossCoresOption )
139
149
}
140
150
151
+ if opts .AlignByUnCoreCacheOption && opts .DistributeCPUsAcrossCores {
152
+ return opts , fmt .Errorf ("static policy options %s and %s can not be used at the same time" , AlignByUnCoreCacheOption , DistributeCPUsAcrossCoresOption )
153
+ }
154
+
141
155
return opts , nil
142
156
}
143
157
0 commit comments