Commit Graph

176 Commits

Author SHA1 Message Date
Michael Crosby 5e729ced92 Ensure all parent dirs are properly setup
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>
2015-06-19 15:56:12 -07:00
Mrunal Patel 107b7ed268 Merge pull request #638 from lizf-os/fix-check-cpu-shares
Avoid trying to access cpu.shares when it doesn't exist
2015-06-18 13:41:58 -07:00
Zefan Li f112d83776 Avoid trying to access cpu.shares when it doesn't exist
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>
2015-06-18 21:15:52 +08:00
Qiang Huang 39279b1762 Fix kmem limit set
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>
2015-06-18 15:44:30 +08:00
unclejack 19f9dea4a8 gofmt to fix formatting
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-06-16 12:26:27 +03:00
Alexander Morozov 61adc0d9c5 Merge pull request #622 from ktraghavendra/621_container_swappiness
Add the memory swappiness tuning support to libcontainer
2015-06-12 13:37:23 -07:00
Alexander Morozov 3716bd9db2 Use simpler parsing of /proc/self/mountinfo for FindCgroupMountpoint
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>
2015-06-11 12:56:55 -07:00
Raghavendra K T ddd92caf18 Add the memory swappiness tuning support to libcontainer
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
2015-06-11 16:56:03 +05:30
Qiang Huang f7c16f1d3e Don't change memswap value in libcontainer
As discussed in https://github.com/docker/libcontainer/issues/616,
remove this logic in libcontainer.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-06-11 08:54:24 +08:00
Alexander Morozov f6ad210785 Stop systemd unit on destroy
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>
2015-06-08 15:06:11 -07:00
Victor Marmol be81d577fd Merge pull request #567 from Mashimiao/support-hugetlb-set-and-getstats
hugetlb: Add support of Set and GetStats function
2015-06-02 09:55:28 -07:00
Michael Crosby 60d043931b Merge pull request #602 from runcom/fix-race-manager-stats-paths
Fix race in stats Manager
2015-05-28 10:23:29 -07:00
Antonio Murdaca 81444369c6 Add mutex in Manager to read from m.Paths
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-28 12:09:27 +02:00
Ma Shimiao 4002033269 hugetlb: Add support of Set and GetStats function
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-28 13:09:49 +08:00
Ma Shimiao 11d2aa07a0 cgroup memory: Enchance stats support of memory
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-28 09:09:01 +08:00
Michael Crosby a4a648ce30 Merge pull request #583 from jhowardmsft/master
Windows: Initial compilation enablement
2015-05-18 11:11:08 -07:00
John Howard c712fa0814 Windows: Initial compilation enablement
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-15 15:26:17 -07:00
Michael Crosby 7adbe0f728 Merge pull request #589 from Mashimiao/cgroup-systemd-add-freezer-set
cgroup: Add freeze Set When calls systemd to Apply
2015-05-15 10:23:38 -07:00
Michael Crosby fabd8e98be Merge pull request #582 from Mashimiao/add-cgroup-subsystem-net_cls
cgroups: add support for net_cls
2015-05-15 10:22:54 -07:00
Qiang Huang 676be0c5f8 Add support for kmem limit
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-15 14:24:56 +08:00
Ma Shimiao d095c66ba6 cgroup: add freeze Set When calls systemd to Apply
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-15 10:39:04 +08:00
Ma Shimiao b88944f9e0 cgroups: add support for net_cls
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-15 08:44:40 +08:00
Victor Marmol 64c5e5193f Merge pull request #584 from Mashimiao/add-cgroup-subsystem-net_prio
cgroup: add support for net_prio
2015-05-14 12:54:45 -07:00
Ma Shimiao 3a788dd7f3 croup cpu: add support for realtime throttling
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-14 20:46:39 +08:00
Ma Shimiao 0810bc868c cgroup: add support for net_prio
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-05-14 14:47:07 +08:00
Victor Marmol a37b2a4f15 Merge pull request #476 from hqhq/hq_dont_fail_subsystem
don't fail when subsystem not mounted
2015-05-11 09:29:59 -07:00
Qiang Huang e5a7aad7eb Replace aliased imports of logrus
Docker already did this: https://github.com/docker/docker/issues/11762
libcontainer should also do it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-06 21:14:04 +08:00
Andrey Vagin 08af005e6b Use logrus everywhere
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-05-01 18:41:28 +03:00
Qiang Huang 36633d3cb4 remove unused functions
Seems no one is using them.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-28 09:20:32 +08:00
Andrey Vagin 755bc77482 cgroups/systemd: remove useless code
I think the remove code and devices.Set do the same things.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-04-28 00:00:24 +03:00
Alexander Morozov 984ec36fa1 Merge pull request #539 from Mashimiao/cgroups-add-support-for-blkio-throttle
cgroups: add support blkio.throttle.read/write_*
2015-04-27 10:34:45 -07:00
Michael Crosby b806655f91 Merge pull request #492 from Mashimiao/cgroup-add-support-for-device-deny
cgroups: add support of devices deny for another use of cgroup devices
2015-04-22 18:43:22 -07:00
Qiang Huang 27d3dd3df3 don't fail when subsystem not mounted
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>
2015-04-22 10:18:22 +08:00
bin liu 4a2ae107c8 fix some typos in source code comments
Signed-off-by: bin liu <liubin0329@gmail.com>
2015-04-20 02:35:51 +00:00
Ma Shimiao 59eb58b640 cgroups: add support blkio.throttle.read/write_*
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-17 16:03:42 +08:00
Qiang Huang e161ceccbe cleanup duplicate code for cpuShares check
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-17 13:18:44 +08:00
Ma Shimiao 689afbcf66 cgroups: add support for devices deny
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-16 08:30:22 +08:00
Alexander Morozov 84f43cdfac Merge pull request #500 from hqhq/hq_add_set_for_systemd
add Set support for systemd based cgroup
2015-04-15 12:23:39 -07:00
Alexander Morozov fc470e199d Merge pull request #464 from shishir-a412ed/cpu_shares_issue
Throw an error if cgroup tries to set cpu-shares more/less than the maximum/minimum permissible value.
2015-04-14 09:04:31 -07:00
Ma Shimiao dfbea73df4 add cgroup subsystem hugetlb
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-11 09:03:08 +08:00
jianbosun 2c3949a687 Change memory usage by minus cache memory
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>
2015-04-09 13:18:46 -07:00
Qiang Huang 054d8e02bf cgroups: add support for blkio.weight_device
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-08 14:11:29 +08:00
Qiang Huang f9a0d21fab cleanup for systemd cgroup
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>
2015-04-02 11:00:35 +08:00
Qiang Huang 4c2886d59a don't change state if systemd freeze failed
It has been fixed in fs base cgroup, but missed in systemd based.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-02 10:22:38 +08:00
Qiang Huang 55dd96592b add Set support for systemd based cgroup
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-02 09:57:04 +08:00
Shishir Mahajan 4e65e0e90a Throw an error if cgroup tries to set cpu-shares more/less than the maximum/minimum permissible value.
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2015-04-01 11:25:13 -04:00
Ma Shimiao 8961fd20e6 cgroups/systemd: Use unified subsystems
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-01 12:04:54 +08:00
Ma Shimiao 0eb8a1aac3 cgroups: reurn error when passing invalid argument to freezer
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-01 00:04:33 +08:00
Mrunal Patel c851275416 Merge pull request #489 from philips/stop-test-unit
cgroups: systemd: attempt to stop test scope, if any
2015-03-30 17:55:21 -05:00
Alexander Morozov dc82e30089 Fix finding parent for fs cgroups
It was just supposed, that parent always like /root/subsystem, but it
can be /root/subsystem1,subsystem2

Fixes docker/docker#10690

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-30 14:12:15 -07:00