Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 2023 00:42:49 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: An idea for swap partition size vs. swap space size in use handling
Message-ID:  <960C016C-9D43-4F24-8913-363676B5E202@yahoo.com>
In-Reply-To: <6F24FD22-ED7B-44E2-B6A6-C82F845C3A56@yahoo.com>
References:  <E187AA6B-6832-4A75-81BC-21E0A999154D.ref@yahoo.com> <E187AA6B-6832-4A75-81BC-21E0A999154D@yahoo.com> <202301220717.30M7H7wC022099@critter.freebsd.dk> <6F24FD22-ED7B-44E2-B6A6-C82F845C3A56@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Jan 22, 2023, at 00:21, Mark Millard <marklmi@yahoo.com> wrote:

> On Jan 21, 2023, at 23:17, Poul-Henning Kamp <phk@phk.freebsd.dk> =
wrote:
>=20
>> --------
>> Mark Millard writes:
>>=20
>>> It would be nice if I could have just one swap partition
>>> on a given boot media, one that is more than sufficient
>>> in size for all but the biggest RAM system --but to then
>>> be able to tell the system to just use up to the
>>> recommended swap space size and to ignore any extra swap
>>> space in the swap partition.
>>=20
>> Last I looked at that code, that is precisely what happens
>> if you add a too big swap-device ?
>=20
> 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:
>=20
> warning: total configured swap (1003519 pages) exceeds maximum =
recommended amount (1003072 pages).
>=20
> Another from a context with a much bigger difference:
>=20
> warning: total configured swap (2097152 pages) exceeds maximum =
recommended amount (916632 pages).
>=20
> These sort of messages are followed by:
>=20
> warning: increase kern.maxswzone or reduce amount of swap.
>=20
> But, as I understand, increasing kern.maxswzone makes
> tradoffs with other kernel memory use. man 8 loader
> reports:

All my references to "man 8 loader" should have been to
"man 8 loader_simp" these days. (Old habit, not yet
replaced.)

>     kern.maxswzone
>                   Limits the amount of KVM to be used to hold swap =
metadata,
>                   which directly governs the maximum amount of swap =
the
>                   system can support . . .
> . . .
>                   Note that swap metadata can be fragmented, which =
means that
>                   the system can run out of space before it reaches =
the
>                   theoretical limit.  Therefore, care should be taken =
to not
>                   configure more swap than approximately half of the
>                   theoretical maximum.
>=20
> (Note: My understanding is that an "approximately half" is the
> figure shown as the "recommended amount" in the warnings.)
>=20
>                   Running out of space for swap metadata can leave the =
system
>                   in an unrecoverable state.  Therefore, you should =
only
>                   change this parameter if you need to greatly extend =
the KVM
>                   reservation for other resources such as the buffer =
cache or
>                   kern.ipc.nmbclusters.  Modifies kernel option
>                   VM_SWZONE_SIZE_MAX.
>=20
> The wording in man 8 loader is about decreasing kern.maxswzone

Again.

> in order to make room for other resources. But the implication
> is that increases leave less room than normal for other
> resources. I try to avoid getting the warnings as I do not have
> knowledge/context to make well-guided tradeoffs for the
> resources.
>=20
> 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.
>=20
> (I was not suggesting changes to default behavior. I was only
> suggesting being able to put it in a mode where it would have
> used, for example, just around 916632 pages of the swap space.)
>=20
>=20
> (Note: Some of the detailed man 8 loader claims that I left out

Again.

> seem to not be general to all platforms, despite the wording
> giving no hint of that issue.)




=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?960C016C-9D43-4F24-8913-363676B5E202>