[lxc-devel] [lxd/master] lxd/cgroup: Fix memory.swappiness detection

stgraber on Github lxc-bot at linuxcontainers.org
Thu Sep 24 03:18:06 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 451 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200923/ceebe583/attachment.bin>
-------------- next part --------------
From 0e3c4e47b12e7b6f6be27dd7c0fd56c9a879a1f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 23 Sep 2020 23:07:33 -0400
Subject: [PATCH] lxd/cgroup: Fix memory.swappiness detection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes swappiness on CgroupV1.
CGroupV2 support is still missing though.

Closes #7916

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/cgroup/init.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/cgroup/init.go b/lxd/cgroup/init.go
index 335d91e820..8fa085a06f 100644
--- a/lxd/cgroup/init.go
+++ b/lxd/cgroup/init.go
@@ -392,6 +392,10 @@ func init() {
 			cgControllers["memory.max_usage_in_bytes"] = V1
 		}
 
+		if shared.PathExists("/sys/fs/cgroup/memory/memory.swappiness") {
+			cgControllers["memory.swappiness"] = V1
+		}
+
 		if shared.PathExists("/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes") {
 			cgControllers["memory.memsw.limit_in_bytes"] = V1
 		}


More information about the lxc-devel mailing list