4 ms·
According to the article, this is not true. The limits become active only when the host cpu is under pressure.
by lovasoa 3y ago
According to the article, this is not true. The limits become active only when the host cpu is under pressure.
- vbezhenar 3y agoI don't think that's correct. --cpus is the same as --cpu-period which is cpu limit. You can easily check it yourself, just run docker container with --cpus set, run multi-core load there and check your activity monitor.
- pbh101 3y agoCFS quotas only become active under contention and even then are relative: if you’re the only thing running on the box and want all the cores but only set one cpu, you get all of them anyway. If you set cpus to 2 and another process sets to 1 and you both try to use all CPUs all out, you’ll get 66% and they’ll get 33%. This isn’t the same as cpusets, which work differently.
- ecnahc515 3y ago> CFS quotas only become active under contention That's not true at all. Take a look at `cpu.cfs_quota_us` in https://kernel.googlesource.com/pub/scm/linux/kernel/git/glommer/memcg/+/cpu_stat/Documentation/cgroups/cpu.txt https://kernel.googlesource.com/pub/scm/linux/kernel/git/glo... It's a hard time limit. It doesn't care about contention at all. `cpu.shares` is relative, for choosing which process gets scheduled, and how often, but the CFS quota is a hard limit on runtime.
- usr1106 3y agoYes, there are hard limits in the CFS. I have used them for thermal reasons in the past, such that the system remained mostly idle although some threads would have had more work to do. Not at my work environment right now, don't remember the parameters I used.
- lovasoa 3y agoI just tried it and you are right. Ran docker run --cpus 0.1 --rm -it progrium/stress --cpu 16 and the machine's cpu sits idle.