c2dfb7
From ef4157dab3d267c33ec2a06ae9bb5e4c87f785a6 Mon Sep 17 00:00:00 2001
c2dfb7
From: Chris Down <chris@chrisdown.name>
c2dfb7
Date: Fri, 3 May 2019 08:40:11 -0400
c2dfb7
Subject: [PATCH] cgroup: Test that it's possible to set memory protection to 0
c2dfb7
 again
c2dfb7
c2dfb7
The previous commit fixes this up, and this should prevent it
c2dfb7
regressing.
c2dfb7
c2dfb7
(cherry picked from commit 465ace74d9820824968ab5e82c81e42c2f1894b0)
c2dfb7
c2dfb7
Related: #1763435
c2dfb7
---
c2dfb7
 src/test/test-cgroup-unit-default.c | 6 +++---
c2dfb7
 test/dml-passthrough-set-ml.service | 2 +-
c2dfb7
 2 files changed, 4 insertions(+), 4 deletions(-)
c2dfb7
c2dfb7
diff --git a/src/test/test-cgroup-unit-default.c b/src/test/test-cgroup-unit-default.c
c2dfb7
index 54f7d50c45..1938609cee 100644
c2dfb7
--- a/src/test/test-cgroup-unit-default.c
c2dfb7
+++ b/src/test/test-cgroup-unit-default.c
c2dfb7
@@ -39,7 +39,7 @@ static int test_default_memory_low(void) {
c2dfb7
          * 1. dml-passthrough.slice sets MemoryLow=100. This should not affect its children, as only
c2dfb7
          *    DefaultMemoryLow is propagated, not MemoryLow. As such, all leaf services should end up with
c2dfb7
          *    memory.low as 50, inherited from dml.slice, *except* for dml-passthrough-set-ml.service, which
c2dfb7
-         *    should have the value of 25, as it has MemoryLow explicitly set.
c2dfb7
+         *    should have the value of 0, as it has MemoryLow explicitly set.
c2dfb7
          *
c2dfb7
          *                                                  ┌───────────┐
c2dfb7
          *                                                  │ dml.slice │
c2dfb7
@@ -49,7 +49,7 @@ static int test_default_memory_low(void) {
c2dfb7
          *                                            │ dml-passthrough.slice │
c2dfb7
          *                                            └───────────┬───────────┘
c2dfb7
          *                    ┌───────────────────────────────────┼───────────────────────────────────┐
c2dfb7
-         *             no new settings                   DefaultMemoryLow=15                     MemoryLow=25
c2dfb7
+         *             no new settings                   DefaultMemoryLow=15                     MemoryLow=0
c2dfb7
          *    ┌───────────────┴───────────────┐  ┌────────────────┴────────────────┐  ┌───────────────┴────────────────┐
c2dfb7
          *    │ dml-passthrough-empty.service │  │ dml-passthrough-set-dml.service │  │ dml-passthrough-set-ml.service │
c2dfb7
          *    └───────────────────────────────┘  └─────────────────────────────────┘  └────────────────────────────────┘
c2dfb7
@@ -122,7 +122,7 @@ static int test_default_memory_low(void) {
c2dfb7
         assert_se(unit_get_ancestor_memory_low(dml_passthrough) == 100);
c2dfb7
         assert_se(unit_get_ancestor_memory_low(dml_passthrough_empty) == dml_tree_default);
c2dfb7
         assert_se(unit_get_ancestor_memory_low(dml_passthrough_set_dml) == 50);
c2dfb7
-        assert_se(unit_get_ancestor_memory_low(dml_passthrough_set_ml) == 25);
c2dfb7
+        assert_se(unit_get_ancestor_memory_low(dml_passthrough_set_ml) == 0);
c2dfb7
 
c2dfb7
         assert_se(unit_get_ancestor_memory_low(dml_override) == dml_tree_default);
c2dfb7
         assert_se(unit_get_ancestor_memory_low(dml_override_empty) == 10);
c2dfb7
diff --git a/test/dml-passthrough-set-ml.service b/test/dml-passthrough-set-ml.service
c2dfb7
index 2abd591389..2e568b5deb 100644
c2dfb7
--- a/test/dml-passthrough-set-ml.service
c2dfb7
+++ b/test/dml-passthrough-set-ml.service
c2dfb7
@@ -5,4 +5,4 @@ Description=DML passthrough set ML service
c2dfb7
 Slice=dml-passthrough.slice
c2dfb7
 Type=oneshot
c2dfb7
 ExecStart=/bin/true
c2dfb7
-MemoryLow=25
c2dfb7
+MemoryLow=0