Even if libcontainer does not create the directories for the cpuset
cgroup we should ensure that they are properly populated with the
parent's cpus and mems values. Some systems create the directory
structures but do not correctly populate the values and causes our
implementation to fail.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Even if cpu cgroup controller is enabled it's still possible that
cpu.shares doesn't exist.
This is the case when the kernel config has CONFIG_CGROUP_SCHED
enabled but CONFIG_FAIR_GROUP_SCHED disabled. Then docker fails to
start containers even --cpu-shares isn't specified.
$ sudo docker run -i -t ubuntu:14.04
Error response from daemon: Cannot start container 5600ae87eb9d0eca49f6bcee012247d6b4beb49c426d6cf17e2456279f9311f6: [8] System error: open /sys/fs/cgroup/cpu/docker/5600ae87eb9d0eca49f6bcee012247d6b4beb49c426d6cf17e2456279f9311f6/cpu.shares: no such file or directory
Signed-off-by: Zefan Li <lizefan@huawei.com>
Currently we can't start container with kmem limit, because we
set kmem limit after processes joined to cgroup, we'll get device
busy error in this case.
Fix it by moving set before join.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
It sped up this function x10 times(because of not using Ssprintf).
It was one of two major performance drawbacks in docker, because we're parsing
this file pretty often.
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
It totally fixes leftover ".scope" fails. Of course it's just
workaround, real issue seems to be in go-systemd library or in systemd
itself.
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
We do this aim two goals:
- don't fail when some subsystems are not mounted (devices cgroup
is an exception because it will cause secirity issues).
- fail hard instead of ignoring the error when a user specifies
an option and we are unable to fulfill the request.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Sun Jianbo <wonderflow@zju.edu.cn>
Add stats.cache into MemoryStats
add cache to the output then client can clarify the results.
Signed-off-by: Sun Jianbo <wonderflow@zju.edu.cn>
Do not subtract cache from usage
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Add join function so we can reduce duplicate code, and we can
call Set api in fs cgroup, that can reduce sync work on fs side
and systemd side.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
It was just supposed, that parent always like /root/subsystem, but it
can be /root/subsystem1,subsystem2
Fixesdocker/docker#10690
Signed-off-by: Alexander Morozov <lk4d4@docker.com>