diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-03 13:01:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-03 13:01:24 +0200 |
commit | 3bd5a11a703cbbc9c02438f2b55873cbba66513e (patch) | |
tree | 7681de9b46a3cdd92150c1e55bed238f76b0aa2b | |
parent | 4a8bcb594c31b594ed16a4be84fb854f64d53b9a (diff) |
Add support for buildos.ram_total, buildos.cpu_affinity
-rwxr-xr-x | buildos | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -229,13 +229,17 @@ fi # And to make it easier to provision memory it's really helpful to base it # on the physical value. # -ram_total=0 -for i in $(sudo dmidecode -t 17 | sed -n -re 's/^\s*Size:\s*([0-9]+)\s*GB.*$/\1/p'); do - ram_total=$(($ram_total + $i * 1024 * 1024)) -done +if [ -z "$ram_total" ]; then + ram_total=0 + for i in $(sudo dmidecode -t 17 | sed -n -re 's/^\s*Size:\s*([0-9]+)\s*GB.*$/\1/p'); do + ram_total=$(($ram_total + $i * 1024 * 1024)) + done -if [ "$ram_total" -eq 0 ]; then - error "unable to determine physical memory size" + if [ "$ram_total" -eq 0 ]; then + error "unable to determine physical memory size, use buildos.ram_total to specify" + fi +else + ram_total=$(($ram_total * 1024 * 1024)) fi cpu_total="$(lscpu | sed -n -re 's/^CPU\(s\): *([0-9]+)$/\1/p')" @@ -277,6 +281,9 @@ function print () echo "cpu_reserved: $cpu_reserved" echo "cpu_overcommit: $cpu_overcommit" echo "cpu_slice: $cpu_slice" + if [ -n "$cpu_affinity" ]; then + echo "cpu_affinity: $cpu_affinity" + fi echo echo "ram_total: $ram_total KB" @@ -921,6 +928,13 @@ function bbot_start () # <toolchain-name> <toolchain-index> -e "s#^ExecStart=[^ ]+(.*)#ExecStart=$id/bin/bbot-agent\1#" \ "$id/lib/systemd/system/bbot-agent@.service" + # Patch in CPU affinity. + # + if [ -n "$cpu_affinity" ]; then + sed -i -r -e "s/^(CPUAffinity)=.*/\1=$cpu_affinity/" \ + "$id/lib/systemd/system/bbot-agent@.service" + fi + # Patch in build/bootstrap/interactive timeouts. # if [ -n "$tbt" ]; then |