diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2019-09-10 13:18:13 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2019-09-10 13:18:13 +0000 |
commit | 188abe57165000ddbb2823cfa524cdc416a2f9b5 (patch) | |
tree | 15f5a90612b9c96941ac622b267b2562a9f08bf9 /start-container-docker.sh | |
parent | 98b2b577ac8df6a26cffbc4d17c95afd91aae849 (diff) |
start-container-docker.sh: Make sure containers get all CPUs
Change-Id: Id3d3b323aaf2c0cfa26a7c0687b6feae7d476d88
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-x | start-container-docker.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh index 5b716aff..c4f6dc53 100755 --- a/start-container-docker.sh +++ b/start-container-docker.sh @@ -272,6 +272,15 @@ for mount in "${volume_mounts[@]}"; do bind_mounts_opt=("${bind_mounts_opt[@]}" "-v" "$mount") done +# Give access to all CPUs to container. +# This happens by default on most machines, but on machines that can put +# unused cores offline (TK1s and TX1s) it can happen that docker cpuset +# cgroup gets configured to use only a subset of cores. If this happens, +# then we have a bug in our HW scripts, and here is the best place +# to detect this problem -- docker run will fail if it can't provide +# any of the CPUs to the new container. +cpuset_opt="--cpuset-cpus 0-$(($nproc - 1))" + echo "DEBUG: starting docker on $session_host from $(hostname), date $(date)" docker_run=($DOCKER run --name $session_name -dtP \ "${bind_mounts_opt[@]}" \ @@ -279,6 +288,7 @@ docker_run=($DOCKER run --name $session_name -dtP \ --memory=${memory}M \ --pids-limit=${pids} \ --cpu-shares=${cpus} \ + $cpuset_opt \ ${docker_opts} \ $image) || ssh_error $? echo "${docker_run[@]}" |