Bug 251993 - sysinstall: Can create swap partition size that generates kern.maxswzone warning
Summary: sysinstall: Can create swap partition size that generates kern.maxswzone warning
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-sysinstall (Nobody)
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2020-12-20 15:47 UTC by Robert Watson
Modified: 2021-12-05 23:31 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Watson freebsd_committer 2020-12-20 15:47:02 UTC
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
Comment 1 Robert Watson freebsd_committer 2020-12-20 15:49:20 UTC
I should have included this further information:

real memory  = 268435456 (256 MB)
avail memory = 218734592 (208 MB)
Comment 2 VVD 2020-12-20 15:59:18 UTC
(In reply to Robert Watson from comment #1)
You can just ignore this warning.
Comment 3 Robert Watson freebsd_committer 2020-12-20 16:12:28 UTC
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?
Comment 4 Robert Watson freebsd_committer 2020-12-20 19:24:17 UTC
(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.
Comment 5 Ed Maste freebsd_committer 2020-12-21 00:15:03 UTC
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.
Comment 6 ota 2020-12-27 00:31:28 UTC
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
Comment 7 Robert Watson freebsd_committer 2020-12-28 11:01:14 UTC
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?
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2021-12-05 23:31:41 UTC
What might a suitable patch look like or do?