integ/kubernetes/kubernetes-1.24.4/debian/deb_folder/patches/kubelet-sort-isolcpus-allocation-when-SMT-enabled.patch
Jim Gauld 6d85d048d0 Debian: Add kubernetes 1.24.4 package
This adds kubernetes 1.24.4 package for Debian, this is built
using golang-1.18.5.

The debian/rules has been updated to align more closely with Debian
Source Package: kubernetes (1.20.5+really1.20.2-1.1), the debian/* files
from this tarball: kubernetes_1.20.5+really1.20.2-1.1.debian.tar.xz .
Reference: https://packages.debian.org/source/bookworm/kubernetes

This has customizations to debian/* overrides (e.g. rules, control,
and kubernetes-x.*. This enables support of kubernetes upgrades with
multiple build versions of kubernetes, and has specific binaries/config
files isolated in stages, with -master, -misc, and -unit-test packages
built but not required in production. Each kubernetes version is built
with a corresponding golang compiler version.

The following patches were cleanly applied and included:
kubeadm-create-platform-pods-with-zero-CPU-resources.patch
Revert-use-subpath-for-coredns-only-for-default-repo.patch
kubernetes-make-isolcpus-allocation-SMT-aware.patch
kubelet-sort-isolcpus-allocation-when-SMT-enabled.patch

The following patches did not apply cleanly. These will be included
in a subsequent commit after porting them to kubernetes 1.24.4.
kubelet-cpumanager-disable-CFS-quota-throttling-for-.patch
kubelet-cpumanager-keep-normal-containers-off-reserv.patch
kubelet-cpumanager-infra-pods-use-system-reserved-CP.patch
kubelet-cpumanager-introduce-concept-of-isolated-CPU.patch
enable-support-for-kubernetes-to-ignore-isolcpus.patch

Test Plan: Debian
PASS: kubernetes-1.24.4 package builds successfully
PASS: all packages build successfully
PASS: build-iso successful with multiple kubernetes versions

Story: 2010301
Task: 46312

Depends-On: https://review.opendev.org/c/starlingx/compile/+/857971

Signed-off-by: Jim Gauld <james.gauld@windriver.com>
Change-Id: I154dcb4087631c5f0d921b008917ae5485b83b15
2022-09-26 12:56:20 -07:00

51 lines
1.9 KiB
Diff

From ba9ab333c8b7dca5252e604837914293dc232732 Mon Sep 17 00:00:00 2001
From: Jim Gauld <James.Gauld@windriver.com>
Date: Fri, 11 Feb 2022 11:06:35 -0500
Subject: [PATCH] kubelet: sort isolcpus allocation when SMT enabled
The existing device manager code returns CPUs as devices in unsorted
order. This numerically sorts isolcpus allocations when SMT/HT is
enabled on the host. This logs SMT pairs, singletons, and algorithm
order details to make the algorithm understandable.
Signed-off-by: Jim Gauld <James.Gauld@windriver.com>
---
pkg/kubelet/cm/devicemanager/manager.go | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/pkg/kubelet/cm/devicemanager/manager.go b/pkg/kubelet/cm/devicemanager/manager.go
index 609da8ed86b..a4b247714f7 100644
--- a/pkg/kubelet/cm/devicemanager/manager.go
+++ b/pkg/kubelet/cm/devicemanager/manager.go
@@ -686,7 +686,16 @@ func order_devices_by_sibling(devices sets.String, needed int) ([]string, error)
return cpu_lst[0]
}
}
+ //Make post-analysis of selection algorithm obvious by numerical sorting
+ //the available isolated cpu_id.
+ cpu_ids := make([]int, 0, int(devices.Len()))
for cpu_id := range devices {
+ cpu_id_, _ := strconv.Atoi(cpu_id)
+ cpu_ids = append(cpu_ids, cpu_id_)
+ }
+ sort.Ints(cpu_ids)
+ for _, _cpu_id := range cpu_ids {
+ cpu_id := strconv.Itoa(_cpu_id)
// If we've already found cpu_id as a sibling, skip it.
if _, ok := _iterated_cpu[cpu_id]; ok {
continue
@@ -728,7 +737,9 @@ func order_devices_by_sibling(devices sets.String, needed int) ([]string, error)
}
}
}
- //klog.Infof("needed=%d ordered_cpu_list=%v", needed, dev_lst)
+ //This algorithm will get some attention. Show minimal details.
+ klog.Infof("order_devices_by_sibling: needed=%d, smtpairs=%v, singletons=%v, order=%v",
+ needed, sibling_lst, single_lst, dev_lst)
return dev_lst, nil
}
func smt_enabled() bool {
--
2.25.1