Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 2023 07:15:14 -0600
From:      Mike Karels <mike@karels.net>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        Poul-Henning Kamp <phk@phk.freebsd.dk>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: An idea for swap partition size vs. swap space size in use handling
Message-ID:  <83FEEEDC-1880-4A7A-B5C9-312FB86D5826@karels.net>
In-Reply-To: <960C016C-9D43-4F24-8913-363676B5E202@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> <960C016C-9D43-4F24-8913-363676B5E202@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22 Jan 2023, at 2:42, Mark Millard wrote:

> 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> wrot=
e:
>>
>>> --------
>>> Mark Millard writes:
>>>
>>>> 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.

Why not just reduce the size of the swap partition to the desired size
with =E2=80=9Cgpart resize=E2=80=9D?  Granted, that requires manual inter=
vention.

		Mike

>>> 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 recomme=
nded amount (1003072 pages).
>>
>> Another from a context with a much bigger difference:
>>
>> warning: total configured swap (2097152 pages) exceeds maximum recomme=
nded amount (916632 pages).
>>
>> These sort of messages are followed by:
>>
>> warning: increase kern.maxswzone or reduce amount of swap.
>>
>> 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 met=
adata,
>>                   which directly governs the maximum amount of swap th=
e
>>                   system can support . . .
>> . . .
>>                   Note that swap metadata can be fragmented, which mea=
ns that
>>                   the system can run out of space before it reaches th=
e
>>                   theoretical limit.  Therefore, care should be taken =
to not
>>                   configure more swap than approximately half of the
>>                   theoretical maximum.
>>
>> (Note: My understanding is that an "approximately half" is the
>> figure shown as the "recommended amount" in the warnings.)
>>
>>                   Running out of space for swap metadata can leave the=
 system
>>                   in an unrecoverable state.  Therefore, you should on=
ly
>>                   change this parameter if you need to greatly extend =
the KVM
>>                   reservation for other resources such as the buffer c=
ache or
>>                   kern.ipc.nmbclusters.  Modifies kernel option
>>                   VM_SWZONE_SIZE_MAX.
>>
>> 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.
>>
>> 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.
>>
>> (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.)
>>
>>
>> (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?83FEEEDC-1880-4A7A-B5C9-312FB86D5826>