From nobody Sun Jan 22 13:15:14 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P0DHb3S5Qz2twt6 for ; Sun, 22 Jan 2023 13:15:23 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 4P0DHb02Flz3ymg for ; Sun, 22 Jan 2023 13:15:22 +0000 (UTC) (envelope-from mike@karels.net) Authentication-Results: mx1.freebsd.org; none Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.16.1/8.16.1) with ESMTP id 30MDFFxi029031; Sun, 22 Jan 2023 07:15:15 -0600 (CST) (envelope-from mike@karels.net) Received: from [10.0.2.130] ([10.0.1.1]) by mail.karels.net with ESMTPSA id hOMZGeM2zWNlcQAA4+wvSQ (envelope-from ); Sun, 22 Jan 2023 07:15:15 -0600 From: Mike Karels To: Mark Millard Cc: Poul-Henning Kamp , freebsd-current Subject: Re: An idea for swap partition size vs. swap space size in use handling Date: Sun, 22 Jan 2023 07:15:14 -0600 X-Mailer: MailMate (1.14r5933) Message-ID: <83FEEEDC-1880-4A7A-B5C9-312FB86D5826@karels.net> In-Reply-To: <960C016C-9D43-4F24-8913-363676B5E202@yahoo.com> References: <202301220717.30M7H7wC022099@critter.freebsd.dk> <6F24FD22-ED7B-44E2-B6A6-C82F845C3A56@yahoo.com> <960C016C-9D43-4F24-8913-363676B5E202@yahoo.com> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4P0DHb02Flz3ymg X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:209, ipnet:216.160.36.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 22 Jan 2023, at 2:42, Mark Millard wrote: > On Jan 22, 2023, at 00:21, Mark Millard wrote: > >> On Jan 21, 2023, at 23:17, Poul-Henning Kamp 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