Does lxcfs have plans to support cpu-shares and cpu-quota?
Hello.
Lxcfs currently does not support the CPU views requested by the cpu-shares and cpu-quota in the container. Is there plan support?
Regards. agile6v
Not sure how that'd get rendered in cpuinfo
Please refer to the implementation of the JDK10. @stgraber
@agile6v I don't see how this maps to /proc/cpuinfo fields which is what LXCFS generates for its CPU view.
@stgraber I understand your doubts. If I run a container with --cpuset-cpus parameter, then the CPU view seen in the container is bound by this container, but the CPU resource is used by this container alone? Obviously not. If so, I think a container with --cpu-shares & --cpu-quota parameter can randomly display corresponding number of CPU in the container.
If I understand it correctly that you'd like to reduce the number of visible CPUs based on cpu.shares or cpu.cfs_{quota,period}_us, I'd be interested in it as well.
@stgraber, could you please elaborate on what problems do you see with /proc/cpuinfo? I think it could calculate the number of available CPUs based on shares/quotas/cpuset, then copy only as many CPUs from the host's /proc/cpuinfo and ignore the rest. It works like this even now, just with cpuset, doesn't it?
/proc/stat would be more complicated, I think. Since a container can utilize more CPUs than we might want to be visible, the usage counters from hidden CPUs would somehow need to be added to the visible CPUs. It should be possible with #244 merged in.
I'm probably going to be experimenting with this.
@aither64 Hi, I think this feature is a very useful, is there something new about your experimenting?
Yes, I have it implemented, but I haven't gotten around to cleaning it up and making a PR yet. It works with CPU quotas set e.g. using lxc.cgroup.cpu.cfs_{quota,period}_us, CPU shares didn't make sense to me.
@aither64 Thanks for your reply. As expected, I tested this feature and it works. It would be nice if make your implemented merged.
@agile6v HI, I try to use lxcfs with cpu-view feature, It seems not work for me. I use docker:
docker run -it --rm -m 256m --cpu-quota 1000 \
-v /var/lib/lxcfs/proc/cpuinfo:/proc/cpuinfo:rw \
-v /var/lib/lxcfs/proc/diskstats:/proc/diskstats:rw \
-v /var/lib/lxcfs/proc/meminfo:/proc/meminfo:rw \
-v /var/lib/lxcfs/proc/stat:/proc/stat:rw \
-v /var/lib/lxcfs/proc/swaps:/proc/swaps:rw \
-v /var/lib/lxcfs/proc/uptime:/proc/uptime:rw \
centos:latest /bin/sh
I don't know why , would you like to give a simple prompt ? Thanks~
@lijiaocn Sorry. I have not tried this feature yet.
What exactly is not implemented? PR 260 says
This patchset reduces the number of CPUs visible in /proc/cpuinfo and /proc/stat based on CPU quotas configured e.g. using lxc.cgroup.cpu.cfs_{quota,period}_us. If qoutas aren't set, it falls back to the current behaviour.
how does docker implement "--cpu-quota" ?
@lijiaocn Hello, I have the same problem,have u resolved it?
This is implemented now and can be used with --enable-cfs.
@brauner Hi, I use the --enable-cfs , get right cpu count in top command, but the /proc/stat file is still wrong
@brauner I use the tag3.1.2 and get the right result, but user the lastest tag the result is still wrong