I installed FreeBSD 12.2 in a VMware virtual machine, and get the following console output on every boot: > warning: total configured swap (262134 pages) exceeds maximum recommended amount (215992 pages). > warning: increase kern.maxswzone or reduce amount of swap. I selected only the defaults going through the installer on the disc1 ISO. It seems like the installer would ideally not create more swap than the kernel supports, or might arrange for loader.conf to be suitably tuned if it were to do so. robert@freebsd-amd64:~/git % gpart list Geom name: da0 modified: false state: OK fwheads: 255 fwsectors: 63 last: 41942999 first: 40 entries: 128 scheme: GPT Providers: 1. Name: da0p1 Mediasize: 524288 (512K) Sectorsize: 512 Stripesize: 0 Stripeoffset: 20480 Mode: r0w0e0 efimedia: HD(1,GPT,11392b84-42b5-11eb-a6e4-000c29a7ef2d,0x28,0x400) rawuuid: 11392b84-42b5-11eb-a6e4-000c29a7ef2d rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f label: (null) length: 524288 offset: 20480 type: freebsd-boot index: 1 end: 1063 start: 40 2. Name: da0p2 Mediasize: 20400570368 (19G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 544768 Mode: r1w1e1 efimedia: HD(2,GPT,11397edd-42b5-11eb-a6e4-000c29a7ef2d,0x428,0x25ffc00) rawuuid: 11397edd-42b5-11eb-a6e4-000c29a7ef2d rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b label: (null) length: 20400570368 offset: 544768 type: freebsd-ufs index: 2 end: 39845927 start: 1064 3. Name: da0p3 Mediasize: 1073700864 (1.0G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 3221245952 Mode: r1w1e0 efimedia: HD(3,GPT,1139fcde-42b5-11eb-a6e4-000c29a7ef2d,0x2600028,0x1fffb0) rawuuid: 1139fcde-42b5-11eb-a6e4-000c29a7ef2d rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b label: (null) length: 1073700864 offset: 20401115136 type: freebsd-swap index: 3 end: 41942999 start: 39845928 Consumers: 1. Name: da0 Mediasize: 21474836480 (20G) Sectorsize: 512 Mode: r2w2e3
I should have included this further information: real memory = 268435456 (256 MB) avail memory = 218734592 (208 MB)
(In reply to Robert Watson from comment #1) You can just ignore this warning.
There's probably also an argument for always allocating enough state to support 1GB of swap, given that possibly that is what the installer thinks is the minimum?
(In reply to VVD from comment #2) I am happily ignoring the warning. But I guess the point I'm trying to make is: Our installer should not, by default, create configurations that require warnings. This might be fixed by changing the behaviour of the installer (set up less swap if we're going to create a configuration that will trigger a warning), or by changing the kernel (e.g., to to tune for at least 1GB of swap no matter the physical memory size, since we've decided in the installer that 1GB is a good minimum). Or maybe the warning is boring and we should suppress it.
Absolutely we should not have warnings that should be ignored or are unactionable after completing a default install. That said, for this specific case I think a warning for the relatively small amount of memory provisioned for the VM might be appropriate.
Or we can grab the maximum from sysctl: % sysctl -d vm.swap_maxpages vm.swap_maxpages: Maximum amount of swap pages supported % sysctl vm.swap_maxpages vm.swap_maxpages: 4019904
If bsdinstall warned that the VM might be under provisioned, and we expect that the VM might get resized as a result, we would likely want to the larger swap size. This suggests that the problem is too many warnings from the kernel, and not enough from the installer?
What might a suitable patch look like or do?
(In reply to Kubilay Kocak from comment #8) The warning was added in: commit 3ff863f1aa52963ea55487477573f70caa275a94 Author: Dag-Erling Smørgrav <des@FreeBSD.org> Date: Thu Aug 16 08:29:49 2012 +0000 - When running out of swzone, instead of spewing an error message every tick until the situation is resolved (if ever), just print a single message when running out and another when space becomes available. - When adding more swap, warn if the total amount exceeds half the theoretical maximum we can handle. Notes: svn path=/head/; revision=239327 I suspect the real issue is: > real memory = 268435456 (256 MB) Typical installations likely involve a minimum of 1GB of RAM, or maybe 512MB. The installer's swap size default is set by: #define SWAP_SIZE(available) MIN(available/20, 4*1024*1024*1024LL) > What might a suitable patch look like or do? Could be one or more of: - add another limit to the SWAP_SIZE MIN(), so that we'd choose less swap for this installation (either "real memory" or the vm.swap_maxpages sysctl) - have the installer produce a warning when run on a system with less than 512MB of RAM - instead of emitting a warning from the kernel, just ignore (do not use) provided swap space that's above what kern.maxswzone permits
^Triage: clear unneeded flags. Nothing has yet been committed to be merged.