Skip to content

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: bobv
  • Loading branch information
jerboaa committed Oct 22, 2020
1 parent f279ddf commit a0b687b
Showing 1 changed file with 26 additions and 33 deletions.
Expand Up @@ -158,41 +158,37 @@ private static void createSubSystemController(CgroupV1Subsystem subsystem, Strin
* setSubSystemPath based on the contents of /proc/self/cgroup
*/
private static void setSubSystemControllerPath(CgroupV1Subsystem subsystem, String[] entry) {
String controllerName;
String base;
CgroupV1SubsystemController controller = null;
CgroupV1SubsystemController controller2 = null;
String controllerName = entry[1];
String base = entry[2];

controllerName = entry[1];
base = entry[2];
if (controllerName != null && base != null) {
switch (controllerName) {
case "memory":
controller = subsystem.memoryController();
break;
case "cpuset":
controller = subsystem.cpuSetController();
break;
case "cpu,cpuacct":
case "cpuacct,cpu":
controller = subsystem.cpuController();
controller2 = subsystem.cpuAcctController();
break;
case "cpuacct":
controller = subsystem.cpuAcctController();
break;
case "cpu":
controller = subsystem.cpuController();
break;
case "blkio":
controller = subsystem.blkIOController();
break;
// Ignore subsystems that we don't support
default:
break;
for (String cName: controllerName.split(",")) {
switch (cName) {
case "memory":
setPath(subsystem, subsystem.memoryController(), base);
break;
case "cpuset":
setPath(subsystem, subsystem.cpuSetController(), base);
break;
case "cpu":
setPath(subsystem, subsystem.cpuController(), base);
break;
case "cpuacct":
setPath(subsystem, subsystem.cpuAcctController(), base);
break;
case "blkio":
setPath(subsystem, subsystem.blkIOController(), base);
break;
// Ignore subsystems that we don't support
default:
break;
}
}
}

}

private static void setPath(CgroupV1Subsystem subsystem, CgroupV1SubsystemController controller, String base) {
if (controller != null) {
controller.setPath(base);
if (controller instanceof CgroupV1MemorySubSystemController) {
Expand All @@ -204,9 +200,6 @@ private static void setSubSystemControllerPath(CgroupV1Subsystem subsystem, Stri
}
subsystem.setActiveSubSystems();
}
if (controller2 != null) {
controller2.setPath(base);
}
}


Expand Down

1 comment on commit a0b687b

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on a0b687b Oct 22, 2020

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.