From 8b4c648fa71e286964d9161fb99867f67192c721 Mon Sep 17 00:00:00 2001 From: The 8472 Date: Sat, 25 Oct 2025 02:26:32 +0200 Subject: [PATCH 1/3] optimize ext4 mount options that can be toggled at runtime. --- .github/workflows/ci.yml | 3 +++ src/ci/scripts/tune-rootfs.sh | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 src/ci/scripts/tune-rootfs.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d440b296d2753..6f5867aad90dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,6 +117,9 @@ jobs: with: fetch-depth: 2 + - name: remount root filesystem + run: src/ci/scripts/tune-rootfs.sh + # Free up disk space on Linux by removing preinstalled components that # we do not need. We do this to enable some of the less resource # intensive jobs to run on free runners, which however also have diff --git a/src/ci/scripts/tune-rootfs.sh b/src/ci/scripts/tune-rootfs.sh new file mode 100755 index 0000000000000..6ac8d96c27dcc --- /dev/null +++ b/src/ci/scripts/tune-rootfs.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -euo pipefail +IFS=$'\n\t' + +source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" + +if isLinux && [[ $(findmnt -n /) =~ "ext4" ]] ; then + # noauto_da_alloc since auto_da_alloc causes sync IO for some common file creation patterns + # lazytime avoids sync IO when (rel)atime updates are applied + # barrier=0 disables write cache flushing, which can reduce latency at the cost of durability, + # but CI machines are ephemeral, so we don't need to be crash-proof. + # + # Ideally we'd set additional options, but those would require + # a reboot or unmounting the rootfs. + sudo mount -oremount,delalloc,lazytime,barrier=0,noauto_da_alloc / + sudo bash -c 'echo "write through" > /sys/block/sda/queue/write_cache' || true + sudo bash -c 'echo "write through" > /sys/block/sdb/queue/write_cache' || true + + ionice -c 3 fstrim / & + + lsblk + + mount +fi From 7b2545a169aee457d77a8824653f2e590ace4372 Mon Sep 17 00:00:00 2001 From: The 8472 Date: Sun, 26 Oct 2025 12:25:48 +0100 Subject: [PATCH 2/3] run iostat while freeing up disk space --- src/ci/scripts/free-disk-space-linux.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ci/scripts/free-disk-space-linux.sh b/src/ci/scripts/free-disk-space-linux.sh index ac3c9cfb28b87..2f4e93ba8b82f 100755 --- a/src/ci/scripts/free-disk-space-linux.sh +++ b/src/ci/scripts/free-disk-space-linux.sh @@ -253,11 +253,16 @@ AVAILABLE_INITIAL=$(getAvailableSpace) printDF "BEFORE CLEAN-UP:" echo "" + +iostat -x 20 & + execAndMeasureSpaceChange cleanPackages "Unused packages" execAndMeasureSpaceChange cleanDocker "Docker images" execAndMeasureSpaceChange cleanSwap "Swap storage" execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories" +kill %1 + # Output saved space statistic echo "" printDF "AFTER CLEAN-UP:" From 964c658eb188912dcfd19421d950bd1f2ee6cbdb Mon Sep 17 00:00:00 2001 From: The 8472 Date: Sun, 26 Oct 2025 13:36:59 +0100 Subject: [PATCH 3/3] parallel delete --- src/ci/scripts/free-disk-space-linux.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/free-disk-space-linux.sh b/src/ci/scripts/free-disk-space-linux.sh index 2f4e93ba8b82f..b20d19cbb5f58 100755 --- a/src/ci/scripts/free-disk-space-linux.sh +++ b/src/ci/scripts/free-disk-space-linux.sh @@ -173,8 +173,11 @@ removeUnusedFilesAndDirs() { fi done - # Remove all files and directories at once to save time. - sudo rm -rf "${to_remove[@]}" + # GHA has high read latencies for uncached data + # so we traverse directories in parallel and feed the output to rm + printf '%s\n' "${to_remove[@]}" | \ + (xargs -P 6 -I{} -- find {} -type f -printf '%p\n\c' || true) | \ + sudo xargs -r -P 8 -n 100 -- rm -rf } execAndMeasureSpaceChange() {