Skip to content

Commit 65fcf61

Browse files
author
Jonathan Dowland
committed
8293472: Incorrect container resource limit detection if manual cgroup fs mounts present
Reviewed-by: sgehwolf Backport-of: 8f3bbe950fb5a3d9f6cae122209df01df0f342f0
1 parent 0f698da commit 65fcf61

File tree

5 files changed

+124
-55
lines changed

5 files changed

+124
-55
lines changed

hotspot/src/os/linux/vm/cgroupSubsystem_linux.cpp

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,36 @@ CgroupSubsystem* CgroupSubsystemFactory::create() {
111111
return new CgroupV1Subsystem(cpuset, cpu, cpuacct, memory);
112112
}
113113

114+
void CgroupSubsystemFactory::set_controller_paths(CgroupInfo* cg_infos,
115+
int controller,
116+
const char* name,
117+
char* mount_path,
118+
char* root_path) {
119+
if (cg_infos[controller]._mount_path != NULL) {
120+
// On some systems duplicate controllers get mounted in addition to
121+
// the main cgroup controllers most likely under /sys/fs/cgroup. In that
122+
// case pick the one under /sys/fs/cgroup and discard others.
123+
if (strstr(cg_infos[controller]._mount_path, "/sys/fs/cgroup") != cg_infos[controller]._mount_path) {
124+
if(PrintContainerInfo) {
125+
tty->print_cr("Duplicate %s controllers detected. Picking %s, skipping %s.",
126+
name, mount_path, cg_infos[controller]._mount_path);
127+
}
128+
os::free(cg_infos[controller]._mount_path);
129+
os::free(cg_infos[controller]._root_mount_path);
130+
cg_infos[controller]._mount_path = os::strdup(mount_path);
131+
cg_infos[controller]._root_mount_path = os::strdup(root_path);
132+
} else {
133+
if(PrintContainerInfo) {
134+
tty->print_cr("Duplicate %s controllers detected. Picking %s, skipping %s.",
135+
name, cg_infos[controller]._mount_path, mount_path);
136+
}
137+
}
138+
} else {
139+
cg_infos[controller]._mount_path = os::strdup(mount_path);
140+
cg_infos[controller]._root_mount_path = os::strdup(root_path);
141+
}
142+
}
143+
114144
bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
115145
const char* proc_cgroups,
116146
const char* proc_self_cgroup,
@@ -263,7 +293,6 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
263293
bool cgroupv2_mount_point_found = false;
264294
bool any_cgroup_mounts_found = false;
265295
while ((p = fgets(buf, MAXPATHLEN, mntinfo)) != NULL) {
266-
char tmp_mount_point[MAXPATHLEN+1];
267296
char tmp_fs_type[MAXPATHLEN+1];
268297
char tmproot[MAXPATHLEN+1];
269298
char tmpmount[MAXPATHLEN+1];
@@ -274,15 +303,13 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
274303
// Cgroup v2 relevant info. We only look for the _mount_path iff is_cgroupsV2 so
275304
// as to avoid memory stomping of the _mount_path pointer later on in the cgroup v1
276305
// block in the hybrid case.
277-
//
278-
if (is_cgroupsV2 && sscanf(p, "%*d %*d %*d:%*d %*s %s %*[^-]- %s %*s %*s", tmp_mount_point, tmp_fs_type) == 2) {
306+
if (is_cgroupsV2 && sscanf(p, "%*d %*d %*d:%*d %s %s %*[^-]- %s %*s %*s", tmproot, tmpmount, tmp_fs_type) == 3) {
279307
// we likely have an early match return (e.g. cgroup fs match), be sure we have cgroup2 as fstype
280-
if (!cgroupv2_mount_point_found && strcmp("cgroup2", tmp_fs_type) == 0) {
308+
if (strcmp("cgroup2", tmp_fs_type) == 0) {
281309
cgroupv2_mount_point_found = true;
282310
any_cgroup_mounts_found = true;
283311
for (int i = 0; i < CG_INFO_LENGTH; i++) {
284-
assert(cg_infos[i]._mount_path == NULL, "_mount_path memory stomping");
285-
cg_infos[i]._mount_path = os::strdup(tmp_mount_point);
312+
set_controller_paths(cg_infos, i, "(cg2, unified)", tmpmount, tmproot);
286313
}
287314
}
288315
}
@@ -305,45 +332,19 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
305332
while ((token = strsep(&cptr, ",")) != NULL) {
306333
if (strcmp(token, "memory") == 0) {
307334
any_cgroup_mounts_found = true;
308-
assert(cg_infos[MEMORY_IDX]._mount_path == NULL, "stomping of _mount_path");
309-
cg_infos[MEMORY_IDX]._mount_path = os::strdup(tmpmount);
310-
cg_infos[MEMORY_IDX]._root_mount_path = os::strdup(tmproot);
335+
set_controller_paths(cg_infos, MEMORY_IDX, token, tmpmount, tmproot);
311336
cg_infos[MEMORY_IDX]._data_complete = true;
312337
} else if (strcmp(token, "cpuset") == 0) {
313338
any_cgroup_mounts_found = true;
314-
if (cg_infos[CPUSET_IDX]._mount_path != NULL) {
315-
// On some systems duplicate cpuset controllers get mounted in addition to
316-
// the main cgroup controllers most likely under /sys/fs/cgroup. In that
317-
// case pick the one under /sys/fs/cgroup and discard others.
318-
if (strstr(cg_infos[CPUSET_IDX]._mount_path, "/sys/fs/cgroup") != cg_infos[CPUSET_IDX]._mount_path) {
319-
if (PrintContainerInfo) {
320-
tty->print_cr("Duplicate cpuset controllers detected. Picking %s, skipping %s.",
321-
tmpmount, cg_infos[CPUSET_IDX]._mount_path);
322-
}
323-
os::free(cg_infos[CPUSET_IDX]._mount_path);
324-
cg_infos[CPUSET_IDX]._mount_path = os::strdup(tmpmount);
325-
} else {
326-
if (PrintContainerInfo) {
327-
tty->print_cr("Duplicate cpuset controllers detected. Picking %s, skipping %s.",
328-
cg_infos[CPUSET_IDX]._mount_path, tmpmount);
329-
}
330-
}
331-
} else {
332-
cg_infos[CPUSET_IDX]._mount_path = os::strdup(tmpmount);
333-
}
334-
cg_infos[CPUSET_IDX]._root_mount_path = os::strdup(tmproot);
339+
set_controller_paths(cg_infos, CPUSET_IDX, token, tmpmount, tmproot);
335340
cg_infos[CPUSET_IDX]._data_complete = true;
336341
} else if (strcmp(token, "cpu") == 0) {
337342
any_cgroup_mounts_found = true;
338-
assert(cg_infos[CPU_IDX]._mount_path == NULL, "stomping of _mount_path");
339-
cg_infos[CPU_IDX]._mount_path = os::strdup(tmpmount);
340-
cg_infos[CPU_IDX]._root_mount_path = os::strdup(tmproot);
343+
set_controller_paths(cg_infos, CPU_IDX, token, tmpmount, tmproot);
341344
cg_infos[CPU_IDX]._data_complete = true;
342345
} else if (strcmp(token, "cpuacct") == 0) {
343346
any_cgroup_mounts_found = true;
344-
assert(cg_infos[CPUACCT_IDX]._mount_path == NULL, "stomping of _mount_path");
345-
cg_infos[CPUACCT_IDX]._mount_path = os::strdup(tmpmount);
346-
cg_infos[CPUACCT_IDX]._root_mount_path = os::strdup(tmproot);
347+
set_controller_paths(cg_infos, CPUACCT_IDX, token, tmpmount, tmproot);
347348
cg_infos[CPUACCT_IDX]._data_complete = true;
348349
}
349350
}

hotspot/src/os/linux/vm/cgroupSubsystem_linux.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ class CgroupSubsystemFactory: AllStatic {
325325
}
326326
#endif
327327

328+
static void set_controller_paths(CgroupInfo* cg_infos,
329+
int controller,
330+
const char* name,
331+
char* mount_path,
332+
char* root_path);
328333
// Determine the cgroup type (version 1 or version 2), given
329334
// relevant paths to files. Sets 'flags' accordingly.
330335
static bool determine_type(CgroupInfo* cg_infos,

hotspot/test/runtime/containers/cgroup/CgroupSubsystemFactory.java

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@ public class CgroupSubsystemFactory {
6363
private Path cgroupv1MntInfoZeroHierarchy;
6464
private Path cgroupv2CgInfoZeroHierarchy;
6565
private Path cgroupv2MntInfoZeroHierarchy;
66+
private Path cgroupv2MntInfoDouble;
67+
private Path cgroupv2MntInfoDouble2;
6668
private Path cgroupv1CgInfoNonZeroHierarchy;
6769
private Path cgroupv1MntInfoNonZeroHierarchyOtherOrder;
6870
private Path cgroupv1MntInfoNonZeroHierarchy;
6971
private Path cgroupv1MntInfoDoubleCpuset;
7072
private Path cgroupv1MntInfoDoubleCpuset2;
73+
private Path cgroupv1MntInfoDoubleMemory;
74+
private Path cgroupv1MntInfoDoubleMemory2;
75+
private Path cgroupv1MntInfoDoubleCpu;
76+
private Path cgroupv1MntInfoDoubleCpu2;
77+
private Path cgroupv1MntInfoDoublePids;
78+
private Path cgroupv1MntInfoDoublePids2;
7179
private Path cgroupv1MntInfoSystemdOnly;
7280
private String mntInfoEmpty = "";
7381
private Path cgroupV1SelfCgroup;
@@ -157,6 +165,15 @@ public class CgroupSubsystemFactory {
157165
private String mntInfoCgroupv1MoreCpusetLine = "121 32 0:37 / /cpusets rw,relatime shared:69 - cgroup none rw,cpuset\n";
158166
private String mntInfoCgroupv1DoubleCpuset = mntInfoCgroupv1MoreCpusetLine + mntInfoHybrid;
159167
private String mntInfoCgroupv1DoubleCpuset2 = mntInfoHybrid + mntInfoCgroupv1MoreCpusetLine;
168+
private String mntInfoCgroupv1MoreMemoryLine = "1100 1098 0:28 / /memory rw,nosuid,nodev,noexec,relatime master:6 - cgroup cgroup rw,memory\n";
169+
private String mntInfoCgroupv1DoubleMemory = mntInfoCgroupv1MoreMemoryLine + mntInfoHybrid;
170+
private String mntInfoCgroupv1DoubleMemory2 = mntInfoHybrid + mntInfoCgroupv1MoreMemoryLine;
171+
private String mntInfoCgroupv1DoubleCpuLine = "1101 1098 0:29 / /cpu,cpuacct rw,nosuid,nodev,noexec,relatime master:7 - cgroup cgroup rw,cpu,cpuacct\n";
172+
private String mntInfoCgroupv1DoubleCpu = mntInfoCgroupv1DoubleCpuLine + mntInfoHybrid;
173+
private String mntInfoCgroupv1DoubleCpu2 = mntInfoHybrid + mntInfoCgroupv1DoubleCpuLine;
174+
private String mntInfoCgroupv1DoublePidsLine = "1107 1098 0:35 / /pids rw,nosuid,nodev,noexec,relatime master:13 - cgroup cgroup rw,pids\n";
175+
private String mntInfoCgroupv1DoublePids = mntInfoCgroupv1DoublePidsLine + mntInfoHybrid;
176+
private String mntInfoCgroupv1DoublePids2 = mntInfoHybrid + mntInfoCgroupv1DoublePidsLine;
160177
private String cgroupsNonZeroHierarchy =
161178
"#subsys_name hierarchy num_cgroups enabled\n" +
162179
"cpuset 3 1 1\n" +
@@ -172,7 +189,11 @@ public class CgroupSubsystemFactory {
172189
"hugetlb 6 1 1\n" +
173190
"pids 3 80 1";
174191
private String mntInfoCgroupsV2Only =
175-
"28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 none rw,seclabel,nsdelegate";
192+
"28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 none rw,seclabel,nsdelegate\n";
193+
private String mntInfoCgroupsV2MoreLine =
194+
"240 232 0:24 /../.. /cgroup-in ro,relatime - cgroup2 cgroup2 rw,nsdelegate\n";
195+
private String mntInfoCgroupsV2Double = mntInfoCgroupsV2MoreLine + mntInfoCgroupsV2Only;
196+
private String mntInfoCgroupsV2Double2 = mntInfoCgroupsV2Only + mntInfoCgroupsV2MoreLine;
176197
private String mntInfoCgroupsV1SystemdOnly =
177198
"35 26 0:26 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup systemd rw,name=systemd\n" +
178199
"26 18 0:19 / /sys/fs/cgroup rw,relatime - tmpfs none rw,size=4k,mode=755\n";
@@ -190,6 +211,12 @@ private void setup() {
190211
cgroupv2MntInfoZeroHierarchy = Paths.get(existingDirectory.toString(), "mountinfo_cgroupv2");
191212
Files.write(cgroupv2MntInfoZeroHierarchy, mntInfoCgroupsV2Only.getBytes());
192213

214+
cgroupv2MntInfoDouble = Paths.get(existingDirectory.toString(), "mountinfo_cgroupv2_double");
215+
Files.write(cgroupv2MntInfoDouble, mntInfoCgroupsV2Double.getBytes());
216+
217+
cgroupv2MntInfoDouble2 = Paths.get(existingDirectory.toString(), "mountinfo_cgroupv2_double2");
218+
Files.write(cgroupv2MntInfoDouble2, mntInfoCgroupsV2Double2.getBytes());
219+
193220
cgroupv1CgInfoNonZeroHierarchy = Paths.get(existingDirectory.toString(), "cgroups_non_zero");
194221
Files.write(cgroupv1CgInfoNonZeroHierarchy, cgroupsNonZeroHierarchy.getBytes());
195222

@@ -217,6 +244,24 @@ private void setup() {
217244
cgroupv1MntInfoDoubleCpuset2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_cpuset2");
218245
Files.write(cgroupv1MntInfoDoubleCpuset2, mntInfoCgroupv1DoubleCpuset2.getBytes());
219246

247+
cgroupv1MntInfoDoubleMemory = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_memory");
248+
Files.write(cgroupv1MntInfoDoubleMemory, mntInfoCgroupv1DoubleMemory.getBytes());
249+
250+
cgroupv1MntInfoDoubleMemory2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_memory2");
251+
Files.write(cgroupv1MntInfoDoubleMemory2, mntInfoCgroupv1DoubleMemory2.getBytes());
252+
253+
cgroupv1MntInfoDoubleCpu = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_cpu");
254+
Files.write(cgroupv1MntInfoDoubleCpu, mntInfoCgroupv1DoubleCpu.getBytes());
255+
256+
cgroupv1MntInfoDoubleCpu2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_cpu2");
257+
Files.write(cgroupv1MntInfoDoubleCpu2, mntInfoCgroupv1DoubleCpu2.getBytes());
258+
259+
cgroupv1MntInfoDoublePids = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_pids");
260+
Files.write(cgroupv1MntInfoDoublePids, mntInfoCgroupv1DoublePids.getBytes());
261+
262+
cgroupv1MntInfoDoublePids2 = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_double_pids2");
263+
Files.write(cgroupv1MntInfoDoublePids2, mntInfoCgroupv1DoublePids2.getBytes());
264+
220265
cgroupv1MntInfoSystemdOnly = Paths.get(existingDirectory.toString(), "mnt_info_cgroupv1_systemd_only");
221266
Files.write(cgroupv1MntInfoSystemdOnly, mntInfoCgroupsV1SystemdOnly.getBytes());
222267

@@ -274,14 +319,14 @@ public void testCgroupv1JoinControllerCombo(WhiteBox wb) {
274319
System.out.println("testCgroupv1JoinControllerMounts PASSED!");
275320
}
276321

277-
public void testCgroupv1MultipleCpusetMounts(WhiteBox wb, Path mountInfo) {
322+
public void testCgroupv1MultipleControllerMounts(WhiteBox wb, Path mountInfo) {
278323
String procCgroups = cgroupv1CgInfoNonZeroHierarchy.toString();
279324
String procSelfCgroup = cgroupV1SelfCgroup.toString();
280325
String procSelfMountinfo = mountInfo.toString();
281326
int retval = wb.validateCgroup(procCgroups, procSelfCgroup, procSelfMountinfo);
282-
Asserts.assertEQ(CGROUPS_V1, retval, "Multiple cpuset controllers, but only one in /sys/fs/cgroup");
327+
Asserts.assertEQ(CGROUPS_V1, retval, "Multiple controllers, but only one in /sys/fs/cgroup");
283328
Asserts.assertTrue(isValidCgroup(retval));
284-
System.out.println("testCgroupv1MultipleCpusetMounts PASSED!");
329+
System.out.println("testCgroupv1MultipleControllerMounts PASSED!");
285330
}
286331

287332
public void testCgroupv1SystemdOnly(WhiteBox wb) {
@@ -324,10 +369,10 @@ public void testCgroupv1MissingMemoryController(WhiteBox wb) {
324369
System.out.println("testCgroupv1MissingMemoryController PASSED!");
325370
}
326371

327-
public void testCgroupv2(WhiteBox wb) {
372+
public void testCgroupv2(WhiteBox wb, Path mountInfo) {
328373
String procCgroups = cgroupv2CgInfoZeroHierarchy.toString();
329374
String procSelfCgroup = cgroupV2SelfCgroup.toString();
330-
String procSelfMountinfo = cgroupv2MntInfoZeroHierarchy.toString();
375+
String procSelfMountinfo = mountInfo.toString();
331376
int retval = wb.validateCgroup(procCgroups, procSelfCgroup, procSelfMountinfo);
332377
Asserts.assertEQ(CGROUPS_V2, retval, "Expected");
333378
Asserts.assertTrue(isValidCgroup(retval));
@@ -362,13 +407,21 @@ public static void main(String[] args) throws Exception {
362407
try {
363408
test.testCgroupv1SystemdOnly(wb);
364409
test.testCgroupv1NoMounts(wb);
365-
test.testCgroupv2(wb);
410+
test.testCgroupv2(wb, test.cgroupv2MntInfoZeroHierarchy);
411+
test.testCgroupv2(wb, test.cgroupv2MntInfoDouble);
412+
test.testCgroupv2(wb, test.cgroupv2MntInfoDouble2);
366413
test.testCgroupV1Hybrid(wb);
367414
test.testCgroupV1HybridMntInfoOrder(wb);
368415
test.testCgroupv1MissingMemoryController(wb);
369416
test.testCgroupv2NoCgroup2Fs(wb);
370-
test.testCgroupv1MultipleCpusetMounts(wb, test.cgroupv1MntInfoDoubleCpuset);
371-
test.testCgroupv1MultipleCpusetMounts(wb, test.cgroupv1MntInfoDoubleCpuset2);
417+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpuset);
418+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpuset2);
419+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleMemory);
420+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleMemory2);
421+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpu);
422+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoubleCpu2);
423+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoublePids);
424+
test.testCgroupv1MultipleControllerMounts(wb, test.cgroupv1MntInfoDoublePids2);
372425
test.testCgroupv1JoinControllerCombo(wb);
373426
} finally {
374427
test.teardown();

hotspot/test/runtime/containers/docker/TestCPUAwareness.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ public static void main(String[] args) throws Exception {
7070
testActiveProcessorCount(2, 2);
7171

7272
// cpu quota and period
73-
testCpuQuotaAndPeriod(50*1000, 100*1000);
74-
testCpuQuotaAndPeriod(100*1000, 100*1000);
75-
testCpuQuotaAndPeriod(150*1000, 100*1000);
76-
testCpuQuotaAndPeriod(400*1000, 100*1000);
73+
testCpuQuotaAndPeriod(50*1000, 100*1000, false);
74+
testCpuQuotaAndPeriod(100*1000, 100*1000, false);
75+
testCpuQuotaAndPeriod(150*1000, 100*1000, false);
76+
testCpuQuotaAndPeriod(400*1000, 100*1000, false);
77+
testCpuQuotaAndPeriod(50*1000, 100*1000, true /* additional cgroup mount */);
7778

7879
testOperatingSystemMXBeanAwareness("0.5", "1");
7980
testOperatingSystemMXBeanAwareness("1.0", "1");
@@ -153,7 +154,7 @@ private static int adjustExpectedAPCForAvailableCPUs(int expectedAPC) {
153154
}
154155

155156

156-
private static void testCpuQuotaAndPeriod(int quota, int period)
157+
private static void testCpuQuotaAndPeriod(int quota, int period, boolean addCgmounts)
157158
throws Exception {
158159
Common.logNewTestCase("test cpu quota and period: ");
159160
System.out.println("quota = " + quota);
@@ -167,6 +168,10 @@ private static void testCpuQuotaAndPeriod(int quota, int period)
167168
.addDockerOpts("--cpu-period=" + period)
168169
.addDockerOpts("--cpu-quota=" + quota);
169170

171+
if (addCgmounts) {
172+
opts = opts.addDockerOpts("--volume", "/sys/fs/cgroup:/cgroups-in:ro");
173+
}
174+
170175
Common.run(opts)
171176
.shouldMatch("CPU Period is.*" + period)
172177
.shouldMatch("CPU Quota is.*" + quota)

hotspot/test/runtime/containers/docker/TestMemoryAwareness.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ public static void main(String[] args) throws Exception {
5151
DockerTestUtils.buildJdkDockerImage(imageName, "Dockerfile-BasicTest", "jdk-docker");
5252

5353
try {
54-
testMemoryLimit("100m", "104857600");
55-
testMemoryLimit("500m", "524288000");
56-
testMemoryLimit("1g", "1073741824");
57-
testMemoryLimit("4g", "4294967296");
54+
testMemoryLimit("100m", "104857600", false);
55+
testMemoryLimit("500m", "524288000", false);
56+
testMemoryLimit("1g", "1073741824", false);
57+
testMemoryLimit("4g", "4294967296", false);
58+
testMemoryLimit("100m", "104857600", true /* additional cgroup mount */);
5859

5960
testMemorySoftLimit("500m", "524288000");
6061
testMemorySoftLimit("1g", "1073741824");
@@ -81,14 +82,18 @@ public static void main(String[] args) throws Exception {
8182
}
8283

8384

84-
private static void testMemoryLimit(String valueToSet, String expectedTraceValue)
85+
private static void testMemoryLimit(String valueToSet, String expectedTraceValue, boolean addCgmounts)
8586
throws Exception {
8687

8788
Common.logNewTestCase("memory limit: " + valueToSet);
8889

8990
DockerRunOptions opts = Common.newOpts(imageName)
9091
.addDockerOpts("--memory", valueToSet);
9192

93+
if (addCgmounts) {
94+
opts = opts.addDockerOpts("--volume", "/sys/fs/cgroup:/cgroups-in:ro");
95+
}
96+
9297
Common.run(opts)
9398
.shouldMatch("Memory Limit is:.*" + expectedTraceValue);
9499
}

0 commit comments

Comments
 (0)