pkg upgrade, vfs.zfs.arc.free_target, vfs.zfs.arc.sys_free, vm.pageout_oom_seq

From: Graham Perrin <grahamperrin_at_gmail.com>
Date: Sat, 30 Aug 2025 09:19:57 UTC
On 30/08/2025 03:46, Graham Perrin wrote:

> …
>
> pkg upgrade -fUy
>
> a) failed at least once with 12 GB memory without tuning
>
> b) succeeded at least once with 13 GB without tuning
>
> c) succeeded at least twice with 2 GB, ARC tuned.
>
> …
>
> Temporarily set before (c):
>
> sysctl vfs.zfs.arc.free_target=256000 

Maybe preferable, an alternative to tuning the ZFS ARC:

vm.pageout_oom_seq=120

First test: 2 GB given to the VirtualBox guest, /boot/loader.conf used 
for the tuning. Success.

Second test: 1 GB given, temporarily tuned in single user mode before an 
exit to multi-user. Success.

Ref: 
<https://lists.freebsd.org/archives/freebsd-ports/2022-August/002459.html> 
– again, thanks to Mark Millard.


The physical storage that I use for the virtual disks is slow, even when 
connected to super speed USB (5Gb/s). An old StoreJet Transcend mobile 
HDD.  The varying slowness might explain why upgrades fails for me (pkg 
killed, failed to reclaim memory) more often than for other testers.

During and after a simple ten-step upgrade from FreeBSD-ports:

grahamperrin@mowa219-gjp4 ~> zpool iostat Transcend 5
               capacity     operations     bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
Transcend    777G   151G     36     65  4.01M  5.00M
Transcend    777G   151G     34    120  5.28M  9.44M
Transcend    777G   151G     79     80  8.04M  5.97M
Transcend    777G   151G     82     42  1.72M  3.99M
Transcend    777G   151G    166     18  3.23M  2.11M
Transcend    777G   151G    157     74  3.89M  5.59M
Transcend    777G   151G     64     91  4.48M  9.01M
Transcend    777G   151G      8     27   904K  2.27M
Transcend    777G   151G      0     18  16.0K  1.36M
Transcend    777G   151G      0      0      0      0
Transcend    777G   151G      0      0      0      0
Transcend    777G   151G      0     12    819   218K
Transcend    777G   151G      0      0      0      0
Transcend    777G   151G      0      0      0      0
Transcend    777G   151G      0      0  15.2K      0
Transcend    777G   151G      0     13      0   369K
Transcend    777G   151G      0     11      0   139K
Transcend    777G   151G      0      0      0      0
^C⏎
grahamperrin@mowa219-gjp4 ~ [SIGINT]> zfs version
zfs-2.3.1-1ubuntu2
zfs-kmod-2.3.1-1ubuntu2
grahamperrin@mowa219-gjp4 ~> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 25.04
Release:        25.04
Codename:       plucky
grahamperrin@mowa219-gjp4 ~>