Skip to content

Commit

Permalink
topology-aware: accept a single isolated reserved CPU.
Browse files Browse the repository at this point in the history
Accept a single hand-picked isolated CPU as the reserved cpuset,
but give a warning about it being isolated. Reject the reserved
cpuset if it mixes isolated with normal CPUs or if it contains
more than a single isolated CPU.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub authored and askervin committed Mar 6, 2025
1 parent 055ebb7 commit 11ac330
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/plugins/topology-aware/policy/topology-aware-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,17 @@ func (p *policy) checkConstraints() error {
"part of the online allowed cpuset (%s)", p.reserved,
p.reserved.Difference(p.allowed), p.allowed)
}
// check that none of the reserved CPUs are isolated
if !p.reserved.Intersection(p.isolated).IsEmpty() {
return policyError("invalid reserved cpuset %s, some CPUs (%s) are also isolated",
p.reserved.Intersection(p.isolated))
// check that if any reserved CPUs are isolated, it is the sole reserved CPU
if isolated := p.reserved.Intersection(p.isolated); !isolated.IsEmpty() {
if !p.reserved.Equals(isolated) {
return policyError("invalid reserved cpuset %s, mixes isolated (%s) and normal (%s)",
p.reserved, isolated, p.reserved.Difference(isolated))
}
if isolated.Size() > 1 {
return policyError("invalid reserved cpuset %s, multiple isolated CPUs (%s)",
p.reserved, isolated)
}
log.Warnf("reserved CPU %s is isolated", p.reserved)
}

case cfgapi.AmountQuantity:
Expand Down

0 comments on commit 11ac330

Please sign in to comment.