[Bug 251993] sysinstall: Can create swap partition size that generates kern.maxswzone warning

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 06 Mar 2023 20:12:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251993

--- Comment #9 from Ed Maste <emaste@freebsd.org> ---
(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

-- 
You are receiving this mail because:
You are the assignee for the bug.