Mercurial > hg > icedtea8-forest > jdk
changeset 14899:a740fff509e6
8254854: [cgroups v1] Metric limits not properly detected on some join controller combinations
Reviewed-by: phh
author | sgehwolf |
---|---|
date | Thu, 22 Oct 2020 16:36:29 +0000 |
parents | 60127f405b1a |
children | facca632f645 |
files | src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java |
diffstat | 1 files changed, 25 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java Tue Jun 30 17:48:06 2015 -0700 +++ b/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java Thu Oct 22 16:36:29 2020 +0000 @@ -184,48 +184,39 @@ * setSubSystemPath based on the contents of /proc/self/cgroup */ private static void setSubSystemPath(Metrics metric, String[] entry) { - String controller; - String base; - SubSystem subsystem = null; - SubSystem subsystem2 = null; - - controller = entry[1]; - base = entry[2]; + String controller = entry[1]; + String base = entry[2]; if (controller != null && base != null) { - switch (controller) { - case "memory": - subsystem = metric.MemorySubSystem(); - break; - case "cpuset": - subsystem = metric.CpuSetSubSystem(); - break; - case "cpu,cpuacct": - case "cpuacct,cpu": - subsystem = metric.CpuSubSystem(); - subsystem2 = metric.CpuAcctSubSystem(); - break; - case "cpuacct": - subsystem = metric.CpuAcctSubSystem(); - break; - case "cpu": - subsystem = metric.CpuSubSystem(); - break; - case "blkio": - subsystem = metric.BlkIOSubSystem(); - break; - // Ignore subsystems that we don't support - default: - break; + for (String cName: controller.split(",")) { + switch (cName) { + case "memory": + setPath(metric, metric.MemorySubSystem(), base); + break; + case "cpuset": + setPath(metric, metric.CpuSetSubSystem(), base); + break; + case "cpuacct": + setPath(metric, metric.CpuAcctSubSystem(), base); + break; + case "cpu": + setPath(metric, metric.CpuSubSystem(), base); + break; + case "blkio": + setPath(metric, metric.BlkIOSubSystem(), base); + break; + // Ignore subsystems that we don't support + default: + break; + } } } + } + private static void setPath(Metrics metric, SubSystem subsystem, String base) { if (subsystem != null) { subsystem.setPath(base); metric.setActiveSubSystems(); } - if (subsystem2 != null) { - subsystem2.setPath(base); - } }