Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmd/plugins/topology-aware/policy/pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,12 @@ func (p *policy) updateSharedAllocations(grant *Grant) {
}
}

func (p *policy) foreachContainer(pool Node, fn func(ctr cache.Container) bool) {
func (p *policy) foreachGrant(pool Node, fn func(g Grant) bool) {
for _, g := range p.allocations.grants {
if !pool.IsSameNode(g.GetCPUNode()) {
continue
}
if done := fn(g.GetContainer()); done {
if done := fn(g); done {
return
}
}
Expand All @@ -639,7 +639,12 @@ func (p *policy) foreachContainer(pool Node, fn func(ctr cache.Container) bool)
func (p *policy) hasZeroCpuReqContainer(pool Node) bool {
found := false

p.foreachContainer(pool, func(ctr cache.Container) bool {
p.foreachGrant(pool, func(g Grant) bool {
if g.CPUType() == cpuReserved && !g.ReservedCPUs().IsEmpty() {
return false
}

ctr := g.GetContainer()
switch ctr.GetQOSClass() {
case corev1.PodQOSBestEffort:
found = true
Expand Down
11 changes: 6 additions & 5 deletions cmd/plugins/topology-aware/policy/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,13 +1280,14 @@ func (cg *grant) String() string {
if !cg.exclusive.IsEmpty() {
exclusive = fmt.Sprintf(", exclusive: %s", cg.exclusive)
}
if cg.ReservedPortion() > 0 {
if cg.ReservedPortion() > 0 || (cg.cpuType == cpuReserved && cg.SharedPortion() == 0) {
reserved = fmt.Sprintf(", reserved: %s (%dm)",
cg.node.FreeSupply().ReservedCPUs(), cg.ReservedPortion())
}
if cg.SharedPortion() > 0 || (isol.IsEmpty() && cg.exclusive.IsEmpty()) {
shared = fmt.Sprintf(", shared: %s (%dm)",
cg.node.FreeSupply().SharableCPUs(), cg.SharedPortion())
} else {
if cg.SharedPortion() > 0 || (isol.IsEmpty() && cg.exclusive.IsEmpty()) {
shared = fmt.Sprintf(", shared: %s (%dm)",
cg.node.FreeSupply().SharableCPUs(), cg.SharedPortion())
}
}

mem := fmt.Sprintf(", memory: %s (%s)", cg.memZone, prettyMem(cg.memSize))
Expand Down