On 12.2 look like vm.max_wired is a hard limit for number of wired pages for user processes. With 48GB of RAM default value is 9727317 - it's 9727317*4096/1024/1024/1024 = ~37.1GB only. Use case: 1) I see 9GB of free RAM 2) started VM in VirtualBox with 8GB 3) started applications in VM 4) VM freezes with VERR_NO_MEMORY error in VBox.log 5) stopped VM 6) 46*1024*1024*1024/4096 = 12058624 sysctl vm.max_wired=12058624 7) repeat 2) and 3) 8) VM work fine now /usr/src/sys/vm/vm_pageout.c (2082): vm_page_max_user_wired = 4 * freecount / 5; From dmesg: avail memory = 50130972672 (47808 MB) 47808 MB * 4/5/1024 = 37.35GB ~= 37.1GB IMHO, it's very incorrect! Something like 99/100 look more correct for VM servers with total RAM 48GB: 47808*99/100/1024 = 46.220625
I want get solution before 13.0 release. 1) Increase default value for vm.max_wired: vm_page_max_user_wired = 99 * freecount / 100; Or 2) Write warning with very big and bold letters about this issue in release notes, in documentation on web-site, in manual pages and etc. It's really critical regression for virtualization servers. P.S. Sorry for my poor english.
Tagging in some VM folks to start with.
1GB max reserved from wired ram: -vm_page_max_user_wired = 4 * freecount / 5; +vm_page_max_user_wired = freecount - min(freecount, 5 * 1048576 / PAGE_SIZE) / 5;
(In reply to VVD from comment #3) Fast fix. 1GB max reserved from wired ram: -vm_page_max_user_wired = 4 * freecount / 5; +vm_page_max_user_wired = freecount - min(freecount, 5 * 1024 * 1024 * 1024 / PAGE_SIZE) / 5;
https://cgit.freebsd.org/src/commit/sys/vm/vm_pageout.c?id=54a3a1142189f60edfbbdfb0e1f4085e2d30c115 https://cgit.freebsd.org/src/commit/sys/vm/vm_pageout.c?id=97458520cc15b26edbf5d5cd5ed54c3253dfa21c
As a workaround: added entry in pkg-message in "Troubleshooting" about "VERR_NO_MEMORY" in ports emulators/virtualbox-ose{,-legacy}.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=23eed6a75321443d7c6c45b92b28ff0e314e0496 commit 23eed6a75321443d7c6c45b92b28ff0e314e0496 Author: Vladimir Druzenko <vvd@FreeBSD.org> AuthorDate: 2023-06-28 11:57:14 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2023-06-28 12:02:00 +0000 emulators/virtualbox-ose{,-legacy}: sort out options Sort out options: order (portlint), convert to OPTION_*. Add entry in "Troubleshooting" about "VERR_NO_MEMORY". Force devel/llvm15 for emulators/virtualbox-ose-legacy on recent 14 with llvm16 in base. PR: 200764 252227 Approved by: arrowd (mentor) Differential Revision: https://reviews.freebsd.org/D40751 emulators/virtualbox-ose-legacy/Makefile | 98 ++++++++++------------ .../virtualbox-ose-legacy/files/patch-configure | 26 ++++-- emulators/virtualbox-ose-legacy/pkg-message | 30 ++++++- emulators/virtualbox-ose/Makefile | 91 +++++++++----------- emulators/virtualbox-ose/files/patch-configure | 26 ++++-- emulators/virtualbox-ose/files/pkg-message.in | 32 ++++++- 6 files changed, 176 insertions(+), 127 deletions(-)