Re: An idea for swap partition size vs. swap space size in use handling

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 26 Feb 2023 05:20:24 UTC
On Feb 25, 2023, at 21:00, Mark Millard <marklmi@yahoo.com> wrote:

> On Feb 25, 2023, at 20:01, Jamie Landeg-Jones <jamie@catflap.org> wrote:
> 
>> Mark Millard <marklmi@yahoo.com> wrote:
>> 
>>> On Jan 21, 2023, at 23:17, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
>>>> 
>>>> Last I looked at that code, that is precisely what happens
>>>> if you add a too big swap-device ?
>>> 
>>> It produces a notice reporting how much bigger what it is
>>> using is than what is recommended, if I understand the
>>> message right. Here is an example were the difference was
>>> small for an armv7 context:
>>> 
>>> warning: total configured swap (1003519 pages) exceeds maximum recommended amount (1003072 pages).
>>> 
>>> Another from a context with a much bigger difference:
>>> 
>>> warning: total configured swap (2097152 pages) exceeds maximum recommended amount (916632 pages).
>>> 
>>> These sort of messages are followed by:
>>> 
>>> warning: increase kern.maxswzone or reduce amount of swap.
>> 
>> I thought the same as phk. And I always thought those messages were
>> just informational warnings on what to do to stop that excess swap
>> space being unused and effectively wasted (i.e. suggestions to change
>> settings, or reduce the swap size!), but you say this isn't correct:
>> 
>>> As I understand, the 2097152 pages vs. 916632 pages example means
>>> that it was operating with the referenced fragmentation problems
>>> being more likely. That would not be true if it was just using
>>> more like the 916632 pages and ignoring the rest.
>> 
>> Are you, phk, or anyone else, able to provide further pointers or
>> clarification on this?
> 
> In:
> 
> https://lists.freebsd.org/archives/freebsd-current/2023-January/003086.html
> 
> I wrote text between the places the places that you quote:
> 
> "warning: increase kern.maxswzone or reduce amount of swap."
> 
> and:
> 
> "As I understand, the 2097152 pages vs. 916632 pages example means"
> 
> that included quotes from man 8 loader, specifically its
> kern.maxswzone material, that indicated there are resource
> tradeoffs in adjusting kern.maxswzone and also indicated that
> "care should be taken to not configure more swap than approximately
> half of the theoretical maximum". It also says that kern.maxswzone
> "directly governs the maximum amount of swap the system can support".
> 
> I'll also note that adjusting kern.maxswzone does not, of itself,
> notably change the amount of swap that would be put to use for the
> same workload.
> 
> So a message reporting to either adjust kern.maxswzone or
> reduce the amount of swap is not documented to just be about
> avoiding unused swap space, so long as the system does not
> reach the "unrecoverable state" that was referenced in the
> same quoted material.
> 
> If what I quoted is insufficient evidence for you, I'm not
> likely to find other evidence that would be sufficient
> for you. (Not that I've ever found other material about
> the issue.)

One adjustment:  I forgot that these days the material that
I originally quoted has moved around and  where to find it
depends on the vintage of FreeBSD in question.

For 13.1-RELEASE:

https://man.freebsd.org/cgi/man.cgi?query=loader&apropos=0&sektion=8&manpath=FreeBSD+13.1-RELEASE&arch=default&format=html

shows it in man 8 loader . (Similarly for older.)

But for 13.2-STABLE:

https://man.freebsd.org/cgi/man.cgi?query=loader_simp&apropos=0&sektion=8&manpath=FreeBSD+13.2-STABLE&arch=default&format=html

shows it in man 8 loader_simp . (Similarly for 14.0-CURRENT.)


===
Mark Millard
marklmi at yahoo.com