Skip to content

Commit

Permalink
topology-aware: avoid isolated CPUs as reserved.
Browse files Browse the repository at this point in the history
Exclude isolated CPUs if we pick reserved CPUs by CPU (resource)
quantity. Log effective reserved cpuset.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub authored and askervin committed Mar 6, 2025
1 parent 11ac330 commit 312d72c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/plugins/topology-aware/policy/topology-aware-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,11 @@ func (p *policy) checkConstraints() error {
}

p.reserveCnt = (int(qty.MilliValue()) + 999) / 1000
// Use CpuAllocator to pick reserved CPUs among
// allowed ones. Because using those CPUs is allowed,
// they remain (they are put back) in the allowed set.
cset, err := p.cpuAllocator.AllocateCpus(&p.allowed, p.reserveCnt, normalPrio.Option())
p.allowed = p.allowed.Union(cset)
// Use CpuAllocator to pick reserved CPUs from the allowed ones but
// avoiding isolated CPUs. The picked CPUs are not removed from the
// allowed set.
from := p.allowed.Difference(p.isolated)
cset, err := p.cpuAllocator.AllocateCpus(&from, p.reserveCnt, normalPrio.Option())
if err != nil {
log.Fatal("cannot reserve %dm CPUs for ReservedResources from AvailableResources: %s", qty.MilliValue(), err)
}
Expand All @@ -592,6 +592,8 @@ func (p *policy) checkConstraints() error {
return policyError("cannot start without CPU reservation")
}

log.Infof("using reserved cpuset %s", p.reserved)

return nil
}

Expand Down

0 comments on commit 312d72c

Please sign in to comment.