Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Mar 2021 08:23:17 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        tech-lists <tech-lists@zyxst.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: The out-of-swap killer makes poor choices
Message-ID:  <132A65F3-E06A-40C1-8488-C421AD02F8F5@yahoo.com>
In-Reply-To: <YD0O28EX/Xa2jc87@cloud.zyxst.net>
References:  <CAOtMX2jYmrK7ftx62_NEfNCWS7O=giHKL1p9kXCqq1t5E1arxA@mail.gmail.com> <YD0O28EX/Xa2jc87@cloud.zyxst.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2021-Mar-1, at 07:57, tech-lists <tech-lists at zyxst.net> wrote:

>=20
> On Tue, Feb 23, 2021 at 01:49:49PM -0700, Alan Somers wrote:
>=20
> [...lots...]
>=20
> I've found that if I take a system already configured with swap, then
> add say 2* 16GB swapfiles as per the handbook, enable the swapfiles,
> that some things will use the swapfile and others not, even with =
plenty
> available in the swapfiles.
>=20
> example: 12-stable amd64 system running poudriere.
>=20
> it will use the swap configured by default (think it's 2GB) as a
> partition. In this example, all of swap is on ssd - the partition and
> both swapfiles. Compiling some things like rust or firefox will use =
all
> of the partition swap and some of the *swapfile* but not all of it[1]. =
It's
> almost like some processes have more of an affinity for swap as a
> partition than others, and others won't use swap as a swapfile at all.
>=20
> In the end, because I don't know how to debug this kind of issue
> further, it was easier to blat the ssd and install 32GB of swap on
> reinstallation of the OS. Swapfiles arent used now, on this particular
> install. The 32GB swap partition is fine and works as expected.
>=20
> Thought the above might be of use as I dunno, a data point. I wonder,
> though, why some programs have seemingly more affinity for =
swap-as-partition than swap-as-swapfile.
>=20
> [1] by "not all of it" I mean fail with an OOM message before all of =
the
> swapfile is used

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206048 for why
swapfiles are problematical and likely should be avoided. In
particular comments #7 and #8 that quote Konstantin Belousov on the
subject (or reference his material).

Part of the text says:

As result, swapfile swapping is more prone to the trivial and =
unavoidable
deadlocks where the pagedaemon thread, which produces free memory, needs
more free memory to make a progress.  Swap write on the raw partition =
over
simple partitioning scheme directly over HBA are usually safe, while =
e.g.
zfs over geli over umass is the worst construction.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?132A65F3-E06A-40C1-8488-C421AD02F8F5>