From 11ac3300d87821491c820d5ad6c850a0fc5090a9 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Wed, 5 Mar 2025 17:11:08 +0200 Subject: [PATCH] topology-aware: accept a single isolated reserved CPU. 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 --- .../policy/topology-aware-policy.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/plugins/topology-aware/policy/topology-aware-policy.go b/cmd/plugins/topology-aware/policy/topology-aware-policy.go index e9858f05a..d7482da0e 100644 --- a/cmd/plugins/topology-aware/policy/topology-aware-policy.go +++ b/cmd/plugins/topology-aware/policy/topology-aware-policy.go @@ -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: