cgroup: Respect DefaultMemoryMin when setting memory.min
authorChris Down <chris@chrisdown.name>
Mon, 30 Sep 2019 17:25:09 +0000 (18:25 +0100)
committerMichael Biebl <biebl@debian.org>
Tue, 19 Nov 2019 08:17:12 +0000 (08:17 +0000)
This is an oversight from https://github.com/systemd/systemd/pull/12332.

Sadly the tests didn't catch it since it requires a real cgroup
hierarchy to see, and it wasn't seen in prod since we're only currently
using DefaultMemoryLow, not DefaultMemoryMin. :-(

(cherry picked from commit 64fe532e90b3e99bf7821ded8a1107c239099e40)
(cherry picked from commit f14e3e02cca759dc92c87328e257acc6abe91cbc)

Gbp-Pq: Name cgroup-Respect-DefaultMemoryMin-when-setting-memory.min.patch

src/core/cgroup.c

index 4ff88fb4c100fafdc201e8775927041eec12c238..94a83e08363847be5d4a9179f6f7ad106f74d685 100644 (file)
@@ -1200,7 +1200,7 @@ static void cgroup_context_apply(
                                         log_cgroup_compat(u, "Applying MemoryLimit=%" PRIu64 " as MemoryMax=", max);
                         }
 
-                        cgroup_apply_unified_memory_limit(u, "memory.min", c->memory_min);
+                        cgroup_apply_unified_memory_limit(u, "memory.min", unit_get_ancestor_memory_min(u));
                         cgroup_apply_unified_memory_limit(u, "memory.low", unit_get_ancestor_memory_low(u));
                         cgroup_apply_unified_memory_limit(u, "memory.high", c->memory_high);
                         cgroup_apply_unified_memory_limit(u, "memory.max", max);