Date: Sun, 22 Jan 2023 00:21:55 -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: <6F24FD22-ED7B-44E2-B6A6-C82F845C3A56@yahoo.com> In-Reply-To: <202301220717.30M7H7wC022099@critter.freebsd.dk> References: <E187AA6B-6832-4A75-81BC-21E0A999154D.ref@yahoo.com> <E187AA6B-6832-4A75-81BC-21E0A999154D@yahoo.com> <202301220717.30M7H7wC022099@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jan 21, 2023, at 23:17, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote: > -------- > 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 ? 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. But, as I understand, increasing kern.maxswzone makes tradoffs with other kernel memory use. man 8 loader reports: 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. (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 = 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. The wording in man 8 loader is about decreasing kern.maxswzone 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 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?6F24FD22-ED7B-44E2-B6A6-C82F845C3A56>