Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8254854: [cgroups v1] Metric limits not properly detected on some joi…
…n controller combinations

Reviewed-by: dcherepanov
Backport-of: a0b687b
  • Loading branch information
Ekaterina Vergizova authored and Dmitry Cherepanov committed Dec 23, 2020
1 parent ea904d8 commit cc78d10
Showing 1 changed file with 25 additions and 34 deletions.
Expand Up @@ -184,41 +184,35 @@ private static void createSubSystem(Metrics metric, String[] mountentry) {
* 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);
if (subsystem instanceof MemorySubSystem) {
Expand All @@ -230,9 +224,6 @@ private static void setSubSystemPath(Metrics metric, String[] entry) {
}
metric.setActiveSubSystems();
}
if (subsystem2 != null) {
subsystem2.setPath(base);
}
}


Expand Down

1 comment on commit cc78d10

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.