< prev index next >

src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java

Print this page
@  rev 57446 : Review changes
|
o  rev 57445 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
|  Reviewed-by: bobv
~
o  rev 56863 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
|  Reviewed-by: bobv
~

*** 64,85 **** } } catch (IOException e) { return null; } ! // For cgroups v1 all controllers need to have non-null hierarchy id boolean isCgroupsV2 = true; boolean anyControllersEnabled = false; for (CgroupInfo info: infos.values()) { isCgroupsV2 = isCgroupsV2 && info.getHierarchyId() == 0; anyControllersEnabled = anyControllersEnabled || info.isEnabled(); } // If no controller is enabled, return no metrics. if (!anyControllersEnabled) { return null; } if (isCgroupsV2) { // read mountinfo so as to determine root mount path String mountPath = null; try (Stream<String> lines = --- 64,96 ---- } } catch (IOException e) { return null; } ! // For cgroups v1 all controllers need to have non-zero hierarchy id boolean isCgroupsV2 = true; boolean anyControllersEnabled = false; + boolean anyCgroupsV2Controller = false; + boolean anyCgroupsV1Controller = false; for (CgroupInfo info: infos.values()) { + anyCgroupsV1Controller = anyCgroupsV1Controller || info.getHierarchyId() != 0; + anyCgroupsV2Controller = anyCgroupsV2Controller || info.getHierarchyId() == 0; isCgroupsV2 = isCgroupsV2 && info.getHierarchyId() == 0; anyControllersEnabled = anyControllersEnabled || info.isEnabled(); } // If no controller is enabled, return no metrics. if (!anyControllersEnabled) { return null; } + // Warn about mixed cgroups v1 and cgroups v2 controllers. The code is + // not ready to deal with that on a per-controller basis. Return no metrics + // in that case + if (anyCgroupsV1Controller && anyCgroupsV2Controller) { + System.err.println("Warning: Mixed cgroupv1 and cgroupv2 not supported. Metrics disabled."); + return null; + } if (isCgroupsV2) { // read mountinfo so as to determine root mount path String mountPath = null; try (Stream<String> lines =
< prev index next >