summaryrefslogtreecommitdiff
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-09-23 16:02:31 -0500
committerLennart Poettering <lennart@poettering.net>2013-09-23 16:02:31 -0500
commite58cec11e6735583c0de7cba68fb68f669472305 (patch)
tree694624087ed1f422ac39d0faa5478d12373847a8 /src/core/cgroup.c
parenta0f708053ba42c8289caed1107f498bbf332e204 (diff)
cgroup: always enable memory.use_hierarchy= for all cgroups in the memory hierarchy
The non-hierarchial mode contradicts the whole idea of a cgroup tree so let's not support this. In the future the kernel will only support the hierarchial logic anyway.
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index d10f205a2f..e66b8f4851 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -254,8 +254,9 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
}
if (mask & CGROUP_MEMORY) {
- char buf[DECIMAL_STR_MAX(uint64_t) + 1];
if (c->memory_limit != (uint64_t) -1) {
+ char buf[DECIMAL_STR_MAX(uint64_t) + 1];
+
sprintf(buf, "%" PRIu64 "\n", c->memory_limit);
r = cg_set_attribute("memory", path, "memory.limit_in_bytes", buf);
} else
@@ -666,6 +667,9 @@ int manager_setup_cgroup(Manager *m) {
/* 6. Figure out which controllers are supported */
m->cgroup_supported = cg_mask_supported();
+ /* 7. Always enable hierarchial support if it exists... */
+ cg_set_attribute("memory", "/", "memory.use_hierarchy", "1");
+
return 0;
}