From fcac138b1eba787e80b89df62c9a48597e83bbd6 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Tue, 25 Jun 2024 20:03:26 +0300 Subject: [PATCH] cpuallocator: don't filter based on single CoreKind. If we have only one type of core present (for instance E-core) and the caller indicates a priority preference which corresponds to an unavailable core type (for instance high-prio/P-core), we don't currently attempt clustered allocation at all, since the initial CoreKind based filtering filters out all CPU clusters as unsuitable. This does not make sense so relax this and only do core type filtering when we have multiple of them (when running on hybrid core architectures). Signed-off-by: Krisztian Litkey --- pkg/cpuallocator/allocator.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkg/cpuallocator/allocator.go b/pkg/cpuallocator/allocator.go index 4748e79c7..f0543b01b 100644 --- a/pkg/cpuallocator/allocator.go +++ b/pkg/cpuallocator/allocator.go @@ -212,15 +212,17 @@ func (a *allocatorHelper) takeIdleClusters() { var ( offline = a.sys.OfflineCPUs() pickIdle = func(c *cpuCluster) (bool, cpuset.CPUSet) { - // we only take E-clusters for low-prio requests - if a.prefer != PriorityLow && c.kind == sysfs.EfficientCore { - a.Debug(" - omit %s, CPU preference is %s", c, a.prefer) - return false, emptyCPUSet - } - // we only take P-clusters for other than low-prio requests - if a.prefer == PriorityLow && c.kind == sysfs.PerformanceCore { - a.Debug(" - omit %s, CPU preference is %s", c, a.prefer) - return false, emptyCPUSet + if len(a.topology.kind) > 1 { + // we only take E-clusters for low-prio requests + if a.prefer != PriorityLow && c.kind == sysfs.EfficientCore { + a.Debug(" - omit %s, CPU preference is %s", c, a.prefer) + return false, emptyCPUSet + } + // we only take P-clusters for other than low-prio requests + if a.prefer == PriorityLow && c.kind == sysfs.PerformanceCore { + a.Debug(" - omit %s, CPU preference is %s", c, a.prefer) + return false, emptyCPUSet + } } // we only take fully idle clusters