Open PureWhiteWu opened 1 year ago
We can refer to https://github.com/uber-go/automaxprocs/commit/ad6f05b8e9b6300affbe6411dbbf48768cbebe73 and https://github.com/uber-go/automaxprocs/commit/721b01340eb5194343487f073ea42e5de8fae8d2 .
I will take a look at this when I have time.
According to this PR, cgroups v2 support was added.
@PureWhiteWu can you give an example of the issue?
For context, I'm debugging some odd behaviour with bad logical CPUs detection under Kubernetes, and I'm interested to see if there's still a bug in some case (when memory limit isn't specified in the pod.spec.container.resources.limits
field).
@asfaltboy Yes, the cgroups v2 seems not working correctly on our kubernetes environment. I'll find an example next week when I'm at work.
@PureWhiteWu did you end up investigating this more?
Sorry for the late reply, too busy these days.
I haven't find a standard way to get the cpu nums from k8s environment with different resource visibility plans (lxcfs or not).
I'll spend some time investigate this asap.
Currently num_cpus doesn't support cgroupv2, maybe we should support it? Spec: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html K8s ref: https://kubernetes.io/docs/concepts/architecture/cgroups/