naccyde / rpms / systemd

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