Skip to content

Commit

Permalink
Updated the control group limit parameters to match cgroupv2
Browse files Browse the repository at this point in the history
Signed-off-by: Roger Barker <[email protected]>
  • Loading branch information
rbarkerSL committed Jun 10, 2024
1 parent 1140f24 commit a59c121
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/push-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ jobs:
GRP_ID="$(id -gn)"
USER_SLICE="user.slice/user-$(id -u).slice"
USER_SERVICE="${USER_SLICE}/user@$(id -u).service"
AGENT_MEM_LIMIT="2147483648"
AGENT_GROUP_NAME="${USER_SERVICE}/agent-${{ github.run_id }}"
DOCKER_MEM_LIMIT="30064771072"
AGENT_MEM_LIMIT="2147483648"
DOCKER_GROUP_NAME="${USER_SERVICE}/docker-${{ github.run_id }}"
AGENT_GROUP_NAME="${USER_SERVICE}/agent-${{ github.run_id }}"
echo "::endgroup::"
echo "::group::Install Control Group Tools"
Expand All @@ -100,16 +101,20 @@ jobs:
echo "::group::Set Control Group Limits"
cgset -r cpu.shares=768 ${DOCKER_GROUP_NAME}
cgset -r cpu.shares=500 ${AGENT_GROUP_NAME}
cgset -r memory.limit_in_bytes=${DOCKER_MEM_LIMIT} ${DOCKER_GROUP_NAME}
cgset -r memory.limit_in_bytes=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME}
cgset -r memory.memsw.limit_in_bytes=${DOCKER_MEM_LIMIT} ${DOCKER_GROUP_NAME}
cgset -r memory.memsw.limit_in_bytes=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME}
cgset -r memory.max=${DOCKER_MEM_LIMIT} ${DOCKER_GROUP_NAME}
cgset -r memory.max=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME}
cgset -r memory.swap.max=${DOCKER_MEM_LIMIT} ${DOCKER_GROUP_NAME}
cgset -r memory.swap.max=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME}
echo "::endgroup::"
echo "::group::Move Runner Processes to Control Group"
sudo cgclassify --sticky -g cpu,memory:${AGENT_GROUP_NAME} $(pgrep 'Runner.Listener' | tr '\n' ' ')
sudo cgclassify -g cpu,memory:${AGENT_GROUP_NAME} $(pgrep 'Runner.Worker' | tr '\n' ' ')
echo "::endgroup::"
ls -al /sys/fs/cgroup/user.slice
ls -al /sys/fs/cgroup/${USER_SLICE}
ls -al /sys/fs/cgroup/${USER_SERVICE}
- name: Build and push UI image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
Expand Down

0 comments on commit a59c121

Please sign in to comment.