daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
c2dfb7
From 9c04746fb35b32b592fe14cab43782db9e0dee5c Mon Sep 17 00:00:00 2001
c2dfb7
From: Chris Down <chris@chrisdown.name>
c2dfb7
Date: Mon, 30 Sep 2019 18:25:09 +0100
c2dfb7
Subject: [PATCH] cgroup: Respect DefaultMemoryMin when setting memory.min
c2dfb7
c2dfb7
This is an oversight from https://github.com/systemd/systemd/pull/12332.
c2dfb7
c2dfb7
Sadly the tests didn't catch it since it requires a real cgroup
c2dfb7
hierarchy to see, and it wasn't seen in prod since we're only currently
c2dfb7
using DefaultMemoryLow, not DefaultMemoryMin. :-(
c2dfb7
c2dfb7
(cherry picked from commit 64fe532e90b3e99bf7821ded8a1107c239099e40)
c2dfb7
c2dfb7
Related: #1763435
c2dfb7
---
c2dfb7
 src/core/cgroup.c | 2 +-
c2dfb7
 1 file changed, 1 insertion(+), 1 deletion(-)
c2dfb7
c2dfb7
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
c2dfb7
index 4299923754..7a9857adad 100644
c2dfb7
--- a/src/core/cgroup.c
c2dfb7
+++ b/src/core/cgroup.c
c2dfb7
@@ -1111,7 +1111,7 @@ static void cgroup_context_apply(
c2dfb7
                                         log_cgroup_compat(u, "Applying MemoryLimit %" PRIu64 " as MemoryMax", max);
c2dfb7
                         }
c2dfb7
 
c2dfb7
-                        cgroup_apply_unified_memory_limit(u, "memory.min", c->memory_min);
c2dfb7
+                        cgroup_apply_unified_memory_limit(u, "memory.min", unit_get_ancestor_memory_min(u));
c2dfb7
                         cgroup_apply_unified_memory_limit(u, "memory.low", unit_get_ancestor_memory_low(u));
c2dfb7
                         cgroup_apply_unified_memory_limit(u, "memory.high", c->memory_high);
c2dfb7
                         cgroup_apply_unified_memory_limit(u, "memory.max", max);