mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-06-12 13:23:41 +03:00
This commit respects online CPU count for process_cpu_cores_available metric. Since CPUQuota may exceed it. Detailed description: There might be a case when `getCPUQuota()` returns a value bigger than available logic CPU cores. In this case the lower value should be used. These changes also reflect upcoming go1.25 changes https://tip.golang.org/doc/go1.25#container-aware-gomaxprocs > If the CPU bandwidth limit is lower than the number of logical CPUs available, GOMAXPROCS will default to the lower limit In practice that happens with [CPU Manager](https://kubernetes.io/blog/2022/12/27/cpumanager-ga/) enabled. It requires setting `/sys/devices/system/cpu/online` which shows the total number of cores on a node. The container doesn't have any cgroup limits, but it's pinned to a limited subset of cores. ``` root@vmselect:/# cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us -1 root@vmselect:/# cat /sys/fs/cgroup/cpu/cpu.cfs_period_us 100000 root@vmselect:/# cat /sys/devices/system/cpu/online 0-255 ``` go1.25 and go.uber.org/automaxprocs don't look into `/sys/devices/system/cpu/online`, VictoriaMetrics does