1
0
mirror of https://github.com/opencontainers/runc.git synced 2026-10-23 19:49:01 +03:00

libct: reuse configs.MaxCPU

Suggested-by: Li Fubang <lifubang@acmcoder.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2026-07-27 17:11:26 -07:00
parent daf934fefc
commit c55649b75e

View File

@@ -202,8 +202,7 @@ func tryResetCPUAffinity(pid int) {
// /sys/devices/system/cpu/possible and kernel_max.
// Instead, we use a huge buffer similarly to go 1.25 runtime in
// getCPUCount().
const maxCPUs = 64 * 1024
buf := unix.NewCPUSet(maxCPUs)
buf := unix.NewCPUSet(configs.MaxCPU)
buf.Fill()
if err := linux.SchedSetaffinity(pid, buf); err != nil {
logrus.WithError(err).Warnf("resetting the CPU affinity of pid %d failed -- the container process may inherit runc's CPU affinity", pid)