diff options
| author | TG0000 <122870448+TG0000@users.noreply.github.com> | 2026-11-23 01:53:09 +0100 |
|---|---|---|
| committer | TG0000 <122870448+TG0000@users.noreply.github.com> | 2026-11-23 01:53:09 +0100 |
| commit | 36aecce11c4f46062a1daba232fb6ccb3c70254e (patch) | |
| tree | 5cf94529e9a400749c5d2c1f7abe32d6355f1067 /runtime/test/large_module_gate_test.cpp | |
| parent | 03b09a086592a197db64d91655c6e65c30764d96 (diff) | |
Honor cgroup v2 limits at the mounted root
Diffstat (limited to 'runtime/test/large_module_gate_test.cpp')
| -rw-r--r-- | runtime/test/large_module_gate_test.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/test/large_module_gate_test.cpp b/runtime/test/large_module_gate_test.cpp index ed8d18a0c..d114095fd 100644 --- a/runtime/test/large_module_gate_test.cpp +++ b/runtime/test/large_module_gate_test.cpp | |||
| @@ -136,6 +136,15 @@ static int cgroup_limits_are_read_up_the_tree() { | |||
| 136 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == 2000); | 136 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == 2000); |
| 137 | write_file(root / "cg/user.slice/app.scope/memory.current", "7000\n"); // over its limit: no room | 137 | write_file(root / "cg/user.slice/app.scope/memory.current", "7000\n"); // over its limit: no room |
| 138 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == 0); | 138 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == 0); |
| 139 | // A mount rooted at a constrained cgroup still exposes its budget at the mount root. | ||
| 140 | write_file(root / "cg/user.slice/app.scope/memory.max", "max\n"); | ||
| 141 | write_file(root / "cg/memory.max", "5000\n"); | ||
| 142 | write_file(root / "cg/memory.current", "3000\n"); | ||
| 143 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == 2000); | ||
| 144 | write_file(root / "self", "0::/\n"); | ||
| 145 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == 2000); | ||
| 146 | write_file(root / "cg/memory.max", "max\n"); | ||
| 147 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == UINT64_MAX); | ||
| 139 | write_file(root / "self", "12:memory:/legacy\n"); // cgroup v1 only: no limit read | 148 | write_file(root / "self", "12:memory:/legacy\n"); // cgroup v1 only: no limit read |
| 140 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == UINT64_MAX); | 149 | CHECK(leonida::cgroup_memory_room((root / "self").string(), (root / "cg").string()) == UINT64_MAX); |
| 141 | CHECK(leonida::cgroup_memory_room((root / "missing").string(), (root / "cg").string()) == UINT64_MAX); | 150 | CHECK(leonida::cgroup_memory_room((root / "missing").string(), (root / "cg").string()) == UINT64_MAX); |