anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0412-cgroup-Test-that-it-s-possible-to-set-memory-protect.patch

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