Skip to content

Commit

Permalink
cpuallocator: don't blindly assume non-empty cpuset.
Browse files Browse the repository at this point in the history
Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub authored and askervin committed Jun 20, 2024
1 parent 307a338 commit 4364132
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/cpuallocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,14 +947,15 @@ func (c *topologyCache) discoverCPUClusters(sys sysfs.System) {
clusters := []*cpuCluster{}
for _, die := range pkg.DieIDs() {
for _, cl := range pkg.LogicalDieClusterIDs(id) {
cpus := pkg.LogicalDieClusterCPUSet(die, cl)
clusters = append(clusters, &cpuCluster{
pkg: id,
die: die,
cluster: cl,
cpus: cpus,
kind: sys.CPU(cpus.List()[0]).CoreKind(),
})
if cpus := pkg.LogicalDieClusterCPUSet(die, cl); cpus.Size() > 0 {
clusters = append(clusters, &cpuCluster{
pkg: id,
die: die,
cluster: cl,
cpus: cpus,
kind: sys.CPU(cpus.List()[0]).CoreKind(),
})
}
}
}
if len(clusters) > 1 {
Expand Down

0 comments on commit 4364132

Please sign in to comment.