Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions src/ci/scripts/free-disk-space-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -253,11 +256,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:"
Expand Down
25 changes: 25 additions & 0 deletions src/ci/scripts/tune-rootfs.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use noatime here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting stuff doesn't just update atime but also ctime and mtime, so I don't think noatime would make a difference here.

Anyway, the settings don't seem to make much of a difference, so this might not be due to sync-write-latency but due to read latency (enumerating the directories) or just being IOPS-starved (anemic cloud hardware).
I'll try running iostat alongside the deletion.

# 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
Loading