3 ms·
It should be noted that the reason this is wrong under Docker is that /proc/cpuinfo is not cgroup-aware. LXC works around this by creating a fake /proc/cpuinfo
by cyphar 6y ago
It should be noted that the reason this is wrong under Docker is that /proc/cpuinfo is not cgroup-aware. LXC works around this by creating a fake /proc/cpuinfo (and /proc/meminfo)[1] which matches the values set by cgroup limits.
[1]: https://github.com/lxc/lxcfs https://github.com/lxc/lxcfs
- musicale 6y agoOver time more things tend to get containerized/virtualized properly so these sorts of issues can be fixed.
- cyphar 6y agoMy understanding is that it's unlikely cpuinfo and meminfo will be made cgroup-aware due to procfs-specific conventions on magic files. Making global procfs files change based on the current process is seen as a bad design these days -- should it be based on the process reading or the process opening the file (in this instance, both solutions are bad but for different reasons)? From memory, the topic was brought up early on in cgroup development.
- bruce_one 6y agoLXCFS can be used with Docker as well (although the integration is manual) which can be quite helpful (eg we're using it with docker-compose and find it very helpful)