From 824de2eaf8b6e174d471bdd73a4438c9d963a86e Mon Sep 17 00:00:00 2001 From: Phil Estes Date: Thu, 18 Jun 2015 19:27:04 -0400 Subject: [PATCH] Initialize swappiness in libcontainer cgroups template By default, the cgroup setting in libcontainer's configs.Cgroup for memory swappiness will default to 0, which is a valid choice for memory swappiness, but that means by default every container's memory swappiness will be set to zero instead of the default 60, which is probably not what users are expecting. When the swappiness UI PR comes into Docker, there will be docker run controls to set this per container, but for now we want to make sure *not* to change the default, as well as work around an older kernel issue that refuses to allow it to be set when cgroup hiearchies are in use. Docker-DCO-1.1-Signed-off-by: Phil Estes (github: estesp) Upstream-commit: 9e9d2276777ba6f48390a33d67ed544b5c183968 Component: engine --- .../daemon/execdriver/native/template/default_template.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/execdriver/native/template/default_template.go b/components/engine/daemon/execdriver/native/template/default_template.go index ecedcfc8cb..79795c8c01 100644 --- a/components/engine/daemon/execdriver/native/template/default_template.go +++ b/components/engine/daemon/execdriver/native/template/default_template.go @@ -36,8 +36,9 @@ func New() *configs.Config { {Type: "NEWNET"}, }), Cgroups: &configs.Cgroup{ - Parent: "docker", - AllowAllDevices: false, + Parent: "docker", + AllowAllDevices: false, + MemorySwappiness: -1, }, Mounts: []*configs.Mount{ {