File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,10 +200,13 @@ jobs:
200200 ref : ${{ inputs.git_ref }}
201201 - name : Ensure swap headroom (avoid OOM during compile/LTO link)
202202 run : |
203- # Idempotent on the persistent self-hosted runner: only create the CI
204- # swapfile once. Gives the fat-LTO linker headroom beyond physical RAM.
205- SWAPFILE=/swapfile-ci
206- if ! sudo swapon --show=NAME --noheadings | grep -qx "$SWAPFILE"; then
203+ # This ~16G-RAM runner needs swap for the fat-LTO release link. The host
204+ # provisions /swapfile (32G); only add a fallback swapfile when the host
205+ # has insufficient swap, so we never waste disk on a duplicate.
206+ SWAP_KB=$(awk '/SwapTotal/{print $2}' /proc/meminfo)
207+ if [ "${SWAP_KB:-0}" -lt 25165824 ]; then # < 24 GiB active swap
208+ SWAPFILE=/swapfile-ci
209+ sudo swapoff "$SWAPFILE" 2>/dev/null || true
207210 sudo rm -f "$SWAPFILE"
208211 sudo fallocate -l 24G "$SWAPFILE" || sudo dd if=/dev/zero of="$SWAPFILE" bs=1M count=24576
209212 sudo chmod 600 "$SWAPFILE"
Original file line number Diff line number Diff line change @@ -44,10 +44,13 @@ jobs:
4444 clean : true
4545 - name : Ensure swap headroom (avoid OOM during compile/LTO link)
4646 run : |
47- # Idempotent on the persistent self-hosted runner: only create the CI
48- # swapfile once. Gives the fat-LTO linker headroom beyond physical RAM.
49- SWAPFILE=/swapfile-ci
50- if ! sudo swapon --show=NAME --noheadings | grep -qx "$SWAPFILE"; then
47+ # This ~16G-RAM runner needs swap for the fat-LTO release link. The host
48+ # provisions /swapfile (32G); only add a fallback swapfile when the host
49+ # has insufficient swap, so we never waste disk on a duplicate.
50+ SWAP_KB=$(awk '/SwapTotal/{print $2}' /proc/meminfo)
51+ if [ "${SWAP_KB:-0}" -lt 25165824 ]; then # < 24 GiB active swap
52+ SWAPFILE=/swapfile-ci
53+ sudo swapoff "$SWAPFILE" 2>/dev/null || true
5154 sudo rm -f "$SWAPFILE"
5255 sudo fallocate -l 24G "$SWAPFILE" || sudo dd if=/dev/zero of="$SWAPFILE" bs=1M count=24576
5356 sudo chmod 600 "$SWAPFILE"
Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ jobs:
3333
3434 - name : Ensure swap headroom (avoid OOM during compile)
3535 run : |
36- # Idempotent on the persistent self-hosted runner: only create the CI
37- # swapfile once. Gives the linker/codegen headroom beyond physical RAM.
38- SWAPFILE=/swapfile-ci
39- if ! sudo swapon --show=NAME --noheadings | grep -qx "$SWAPFILE"; then
36+ # This ~16G-RAM runner needs swap for native compilation. The host
37+ # provisions /swapfile (32G); only add a fallback swapfile when the host
38+ # has insufficient swap, so we never waste disk on a duplicate.
39+ SWAP_KB=$(awk '/SwapTotal/{print $2}' /proc/meminfo)
40+ if [ "${SWAP_KB:-0}" -lt 25165824 ]; then # < 24 GiB active swap
41+ SWAPFILE=/swapfile-ci
42+ sudo swapoff "$SWAPFILE" 2>/dev/null || true
4043 sudo rm -f "$SWAPFILE"
4144 sudo fallocate -l 24G "$SWAPFILE" || sudo dd if=/dev/zero of="$SWAPFILE" bs=1M count=24576
4245 sudo chmod 600 "$SWAPFILE"
You can’t perform that action at this time.
0 commit comments