Skip to content

Commit 4e76a74

Browse files
sphrasavathajcaldelas
authored andcommitted
New policy optino 'align-cpus-by-uncorecache' for Split L3 Topology to take CPUs by uncourecache grouping.
1 parent c90702d commit 4e76a74

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

pkg/kubelet/cm/cpumanager/policy_options.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
DistributeCPUsAcrossNUMAOption string = "distribute-cpus-across-numa"
3434
AlignBySocketOption string = "align-by-socket"
3535
DistributeCPUsAcrossCoresOption string = "distribute-cpus-across-cores"
36+
AlignByUnCoreCacheOption string = "align-cpus-by-uncorecache"
3637
)
3738

3839
var (
@@ -43,6 +44,7 @@ var (
4344
)
4445
betaOptions = sets.New[string](
4546
FullPCPUsOnlyOption,
47+
AlignByUnCoreCacheOption,
4648
)
4749
stableOptions = sets.New[string]()
4850
)
@@ -86,6 +88,9 @@ type StaticPolicyOptions struct {
8688
// cpus (HT) on different physical core.
8789
// This is a preferred policy so do not throw error if they have to packed in one physical core.
8890
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
8994
}
9095

9196
// NewStaticPolicyOptions creates a StaticPolicyOptions struct from the user configuration.
@@ -121,7 +126,12 @@ func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOption
121126
return opts, fmt.Errorf("bad value for option %q: %w", name, err)
122127
}
123128
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
125135
default:
126136
// this should never be reached, we already detect unknown options,
127137
// but we keep it as further safety.
@@ -138,6 +148,10 @@ func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOption
138148
return opts, fmt.Errorf("static policy options %s and %s can not be used at the same time", DistributeCPUsAcrossNUMAOption, DistributeCPUsAcrossCoresOption)
139149
}
140150

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+
141155
return opts, nil
142156
}
143157

0 commit comments

Comments
 (0)