Skip to content

Commit

Permalink
feat: linux control group version 2 API support cgroup v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangxinDong committed Nov 8, 2022
1 parent 2d9c631 commit 207f895
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ default Path getCgroupFreezePath(String componentName) {

void handleCpuLimits(GreengrassService component, double cpu) throws IOException;

void pauseComponentProcessesCore(GreengrassService component, List<Process> processes) throws IOException;
void pauseComponentProcessesCore(GreengrassService component) throws IOException;

void resumeComponentProcesses(GreengrassService component) throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void handleCpuLimits(GreengrassService component, double cpu) throws IOEx
}

@Override
public void pauseComponentProcessesCore(GreengrassService component, List<Process> processes)
public void pauseComponentProcessesCore(GreengrassService component)
throws IOException {
if (LinuxSystemResourceController.CgroupFreezerState.FROZEN.equals(
currentFreezerCgroupState(component.getServiceName()))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.List;
import java.util.Set;

@SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME",
Expand Down Expand Up @@ -114,7 +113,7 @@ public void handleCpuLimits(GreengrassService component, double cpu) throws IOEx
}

@Override
public void pauseComponentProcessesCore(GreengrassService component, List<Process> processes)
public void pauseComponentProcessesCore(GreengrassService component)
throws IOException {
Files.write(getCgroupFreezerStateFilePath(component.getServiceName()),
String.valueOf(CgroupV2FreezerState.FROZEN.getIndex()).getBytes(StandardCharsets.UTF_8),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void addComponentProcess(GreengrassService component, Process process) {
@Override
public void pauseComponentProcesses(GreengrassService component, List<Process> processes) throws IOException {
prePauseComponentProcesses(component, processes);
freezerCgroup.pauseComponentProcessesCore(component, processes);
freezerCgroup.pauseComponentProcessesCore(component);
}


Expand Down

0 comments on commit 207f895

Please sign in to comment.