vpsfreecz / vpsadminos

Host for Linux system containers based on NixOS, ZFS and LXC
https://vpsadminos.org
MIT License
155 stars 26 forks source link

Virtualize /sys/devices/system/cpu #20

Closed aither64 closed 5 years ago

aither64 commented 5 years ago

Applications use info from /sys/devices/system/cpu/online to learn how many CPUs they can use. We need to virtualize this either in kernel or in LXCFS to return the number of available CPUs based on CPU quotas. We may have to handle /sys/devices/system/cpu/cpuN/online as well. The returned values should match the patched sched_getaffinity() syscall.

snajpa commented 5 years ago

Waiting for https://lwn.net/Articles/766155/ to land mainline, then we can work on virtualizing relevant parts of sysfs and procfs (memory, cpus, network interfaces, other devices...).

aither64 commented 5 years ago

I consider this resolved by 9816e8609ad82f533c41b9645e08f49bad2a6362. It's definitely not perfect: cpu/cpuN/online files aren't handled and the returned value does not match sched_getaffinity(). It's the best we can do at the moment, open new issues for further improvements if needed.