-
-
Save iomonad/cb7833fb60a96475e20cc5a507fb1dee to your computer and use it in GitHub Desktop.
Run Gentoo Portage in a cpu cgroup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PORTAGE_IONICE_COMMAND="/usr/local/sbin/portage-cgroup \${PID}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CGROUP_CPU_ROOT="/sys/fs/cgroup/cpu" | |
PORTAGE_CPU_SHARES=512 | |
# $1 must be the portage PID | |
[ -n "$1" ] || exit 1 | |
echo "/usr/local/sbin/remove-empty-cpu-cgroup" > "${CGROUP_CPU_ROOT}/release_agent" | |
cgroup=$(mktemp -d --tmpdir="${CGROUP_CPU_ROOT}" portage-XXXX) && | |
echo $1 > "${cgroup}/tasks" && | |
echo 1 > "${cgroup}/notify_on_release" && | |
echo ${PORTAGE_CPU_SHARES} > "${cgroup}/cpu.shares" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CGROUP_CPU_ROOT="/sys/fs/cgroup/cpu" | |
[ -n "${1}" ] || exit 1 | |
cgroup="${CGROUP_CPU_ROOT}/${1}" | |
rmdir "${cgroup}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment