Re: kernel: warning: total configured swap (493567 pages) exceeds maximum recommended amount

From: bob prohaska <fbsd_at_www.zefox.net>
Date: Tue, 11 Nov 2025 16:46:47 UTC
On Tue, Nov 11, 2025 at 04:34:43PM +0100, Dag-Erling Smørgrav wrote:
> 
> The amount of swap space you can use is limited by the size of the data
> structures used to manage it.  These structures must be preallocated
> (otherwise we might deadlock trying to allocate more while already low
> on memory) and cannot be swapped out (we wouldn't know how to swap them
> back in) so getting the size right on a memory-constrained system can be
> quite tricky.  If you configure more swap than half the amount that can
> be managed, you get the above warning, which you can safely ignore
> unless you either need a lot of swap or have very little physical memory
> and don't need much swap.
> 
> See also <https://reviews.freebsd.org/D53688>.

So I'm flirting with trouble on a system (Pi2/armv7 FWIW) reporting
warning: total configured swap (1024000 pages) exceeds maximum recommended amount (467488 pages).
warning: increase kern.maxswzone or reduce amount of swap. ?


I'm seeing random silent hangs (no debugger escape) but they happen when swap use is
much less than half the physical maximum, sometimes less than 50 MB. Highest peak use
is generally less than 700 MB, usually much less. 

Thanks very much for writing!

bob prohaska