Skip to content

Commit

Permalink
moss: Prime vfs cache on boot via systemd service
Browse files Browse the repository at this point in the history
This should serve to make the first blit after boot run against a hot vfs
cache, which should improve the performance of the first blit for Serpent
OS systems installed to ext4 or f2fs roots in particular.

Neither ext4 nor f2fs blits will be as fast as xfs blits (though,
surprisingly enough, ext4 blits come very close w/ hot blits), so xfs
currently remains the recommended root filesystem for Serpent OS.

Additionally, include a oneshot .service for testing the time to prime
w/ a cold vfs cache. Per the request of @ikeycode this service is gated
behind a `ConditionKernelCommandLine=moss.debug` flag, ensuring that it
will never be started by accident.

Users who need this sort of functionality can add a drop-in
`/etc/kernel/cmdline.d/moss.debug.cmdline` snippet to access it.

This PR was also rebased onto the main branch, which now shows blit stats
on actions creating a new fstx.

Signed-off-by: Rune Morling <[email protected]>
  • Loading branch information
ermo committed Jan 21, 2025
1 parent e8a91f8 commit ba51c88
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
Binary file modified m/moss/manifest.x86_64.bin
Binary file not shown.
4 changes: 3 additions & 1 deletion m/moss/manifest.x86_64.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"/usr/lib/kernel/cmdline.d/00-quiet.cmdline",
"/usr/lib/kernel/cmdline.d/10-amdgpu.cmdline",
"/usr/lib/moss/moss-fstx.sh",
"/usr/lib/systemd/system/moss-benchmark-time-to-prime-asset-store-vfs-cache.service",
"/usr/lib/systemd/system/moss-fstx.service",
"/usr/lib/systemd/system/moss-prime-asset-store-vfs-cache.service",
"/usr/share/bash-completion/completions/moss",
"/usr/share/defaults/etc/profile.d/80-command-not-found.sh",
"/usr/share/fish/completions/moss.fish",
Expand Down Expand Up @@ -64,6 +66,6 @@
}
},
"source-name": "moss",
"source-release": "77",
"source-release": "78",
"source-version": "0.25.1+git.e5ea34d"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Time to prime moss asset store in vfs cache in the background
RequiresMountsFor=/
# Avoid the present service being started by accident and slowing down boot
ConditionKernelCommandLine=moss.debug

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c "sync && echo 3 > /proc/sys/vm/drop_caches"
ExecStart=/usr/bin/bash -c "time nice -n20 ionice -c Idle find /.moss/assets |xargs --max-lines=1000 --max-procs=$(nproc) stat -t >/dev/null"
10 changes: 10 additions & 0 deletions m/moss/pkg/moss-prime-asset-store-vfs-cache.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Prime moss asset store in vfs cache in the background
RequiresMountsFor=/

[Service]
Type=simple
ExecStart=/usr/bin/bash -c "time nice -n20 ionice -c Idle find /.moss/assets |xargs --max-lines=1000 --max-procs=$(nproc) stat -t >/dev/null"

[Install]
WantedBy=basic.target
6 changes: 5 additions & 1 deletion m/moss/stone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
name : moss
version : 0.25.1+git.e5ea34d
release : 77
release : 78
summary : Serpent OS package manager
license : MPL-2.0
homepage : https://github.com/serpent-os/tools
Expand Down Expand Up @@ -61,3 +61,7 @@ install : |
%install_file boot/module/module-setup.sh %(installroot)%(libdir)/dracut/modules.d/90moss/module-setup.sh
%install_file boot/moss-fstx.service %(installroot)%(libdir)/systemd/system/moss-fstx.service
%install_exe boot/moss-fstx.sh %(installroot)%(libdir)/moss/moss-fstx.sh
# Ensure that blits happen against hot vfs cache (quicker first blits)
%install_file %(pkgdir)/moss-prime-asset-store-vfs-cache.service %(installroot)%(libdir)/systemd/system/moss-prime-asset-store-vfs-cache.service
%install_file %(pkgdir)/moss-benchmark-time-to-prime-asset-store-vfs-cache.service %(installroot)%(libdir)/systemd/system/moss-benchmark-time-to-prime-asset-store-vfs-cache.service

0 comments on commit ba51c88

Please sign in to comment.