On Tue, Feb 18, 2025 at 11:33 AM Thomas Munro <thomas.mu...@gmail.com> wrote:
> Maybe we could try this?
>
> https://man.netbsd.org/mount_tmpfs.8
> https://man.openbsd.org/mount_tmpfs.8

NetBSD's test_world: 10:30 -> 3:23
OpenBSD test_world: 15:45 - >9:10

I think NetBSD would finish around 2nd place if turned on by default
like that.  The OpenBSD part needs more work though, see attached...
From f28ad02574090c4690bce639b47ee301a3d857cc Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.mu...@gmail.com>
Date: Fri, 28 Feb 2025 22:19:07 +1300
Subject: [PATCH 1/2] ci: Use a RAM disk for NetBSD and OpenBSD.

Run all the tests on a RAM disk, because it goes faster.  Harmonize the
setup for all three BSD CI tasks into one script, replacing the old
FreeBSD-specific one from commit 0265e5c1.

XXX OpenBSD not good enough yet

ci-os-only: freebsd netbsd openbsd
---
 .cirrus.tasks.yml                       |  4 +--
 src/tools/ci/gcp_freebsd_repartition.sh | 26 ------------------
 src/tools/ci/prepare_filesystem.sh      | 36 +++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 28 deletions(-)
 delete mode 100755 src/tools/ci/gcp_freebsd_repartition.sh
 create mode 100755 src/tools/ci/prepare_filesystem.sh

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 91b51142d2e..2858dc1194e 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -155,8 +155,7 @@ task:
 
   ccache_cache:
     folder: $CCACHE_DIR
-  # Work around performance issues due to 32KB block size
-  repartition_script: src/tools/ci/gcp_freebsd_repartition.sh
+  prepare_filesystem_script: src/tools/ci/prepare_filesystem.sh
   create_user_script: |
     pw useradd postgres
     chown -R postgres:postgres .
@@ -277,6 +276,7 @@ task:
   ccache_cache:
     folder: $CCACHE_DIR
 
+  prepare_filesystem_script: src/tools/ci/prepare_filesystem.sh
   create_user_script: |
     useradd postgres
     chown -R postgres:users /home/postgres
diff --git a/src/tools/ci/gcp_freebsd_repartition.sh b/src/tools/ci/gcp_freebsd_repartition.sh
deleted file mode 100755
index 3adb8fb88ec..00000000000
--- a/src/tools/ci/gcp_freebsd_repartition.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-set -e
-set -x
-
-# fix backup partition table after resize
-gpart recover da0
-gpart show da0
-
-# delete and re-add swap partition with expanded size
-swapoff -a
-gpart delete -i 3 da0
-gpart add -t freebsd-swap -l swapfs -a 4096 da0
-gpart show da0
-swapon -a
-
-# create a file system on a memory disk backed by swap, to minimize I/O
-mdconfig -a -t swap -s20g -u md1
-newfs -b 8192 -U /dev/md1
-
-# migrate working directory
-du -hs $CIRRUS_WORKING_DIR
-mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
-mkdir $CIRRUS_WORKING_DIR
-mount -o noatime /dev/md1 $CIRRUS_WORKING_DIR
-cp -a $CIRRUS_WORKING_DIR.orig/ $CIRRUS_WORKING_DIR/
diff --git a/src/tools/ci/prepare_filesystem.sh b/src/tools/ci/prepare_filesystem.sh
new file mode 100755
index 00000000000..dd203de4915
--- /dev/null
+++ b/src/tools/ci/prepare_filesystem.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+set -x
+
+# migrate working directory to tmpfs
+du -hs $CIRRUS_WORKING_DIR
+mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
+mkdir $CIRRUS_WORKING_DIR
+case "`uname`" in
+
+  FreeBSD|NetBSD)
+    mount -t tmpfs tmpfs $CIRRUS_WORKING_DIR
+    ;;
+
+  OpenBSD)
+    # tmpfs is broken on OpenBSD.  mfs is similar but you need a size up front
+    # and that needs to be backed by swap, so we'll somehow need to add swap,
+    # either here or on the image.
+
+    #du -h
+    #umount /usr/obj  # unused 5G on /dev/sd0j
+    #swapon /dev/sd0j # fails with ENXIO... what am I missing?
+
+    # XXX As a temporary hack, mount a 4GB file as swap.
+    dd if=/dev/zero of=/usr/obj/big.swap bs=1M count=4096
+    swapon /usr/obj/big.swap
+
+    mount -t mfs -o rw,noatime,nodev,-s=8000000 swap $CIRRUS_WORKING_DIR
+    ;;
+
+  *)
+    echo "I don't know how to create a RAM disk on this computer"
+    exit 1
+esac
+cp -a $CIRRUS_WORKING_DIR.orig/. $CIRRUS_WORKING_DIR/
-- 
2.48.1

Reply via email to