From Newsgroup: muc.lists.freebsd.stable
--0000000000005f63dc064882493e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Fri, Jan 16, 2026 at 7:30=E2=80=AFAM Tomoaki AOKI <
junchoon@dec.sakura.n= e.jp>
wrote:
On Fri, 16 Jan 2026 13:48:04 +0200
Nikos Vassiliadis <nvass@gmx.com> wrote:
On 1/14/26 21:45, Mark Millard wrote:
FYI for another issue,
I would never recommend swapping to a file in a file system (vnode), especially to a zfs file:
QUOTE ( https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206048#c7=
)
On 2017-Feb-13, at 7:20 PM, Konstantin Belousov <kostikbel at
gmail.com>
wrote on the freebsd-arm list:
. . .
swapfile write requires the write request to come through the
filesystem
write path, which might require the filesystem to allocate more memor=
y
and read some data. E.g. it is known that any ZFS write request
allocates memory, and that write request on large UFS file might
require
allocating and reading an indirect block buffer to find the block
number
of the written block, if the indirect block was not yet read.
As result, swapfile swapping is more prone to the trivial and
unavoidable deadlocks where the pagedaemon thread, which produce 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.
END QUOTE
I have in the past suffered such consequences.
That's good to say because everybody is saying that it is not
recommended but most of the time people have no first hand experience o=
f
a failure.
While this system have a few GBs of swap I removed it temporarily and I used a zvol for swap. When I am done it will have the traditional swap partition...
Well, IIUC, using zvol for swap still has some risk.
zvol gives functionalities of underlying pool like checksumming,
if configured as such, also compression and crypt.
Of course this functionalities consumes memories.
So, not sure how OpenZFS is impmemented, it should mis-behave
(including panics / crashes) under heavy thrushing situations
unless memories needed for the features are statically allocated
and strictly pinned to physical memory.
Swap partitions are the safest.
This is absolutely true. You can swap to raw partitions without allocating additional memory (and when the write is complete, free up the memory
for other things). With zvol, there's many memory allocations needed to
do the I/O, which can deadlock in low memory situations (eg, you need
memory to free memory and can't until memory is freed...).
zvols are great for a large variety of things. swap partitions aren't one
of them, except in very limited circumstances where you have a little
memory pressure to force things out, but are never running anywhere
close to the edge. Not 'rarely' but 'never'.
Warner
--0000000000005f63dc064882493e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g= mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Jan 16,=
2026 at 7:30=E2=80=AFAM Tomoaki AOKI <<a href=3D"mailto:
junchoon@dec.sa= kura.ne.jp">
junchoon@dec.sakura.ne.jp</a>> wrote:<br></div><blockquote c= lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex">On Fri, 16 Jan 2026 13:48:04 +0200<br> Nikos Vassiliadis <<a href=3D"mailto:
nvass@gmx.com" target=3D"_blank">nv=
ass@gmx.com</a>> wrote:<br>
> On 1/14/26 21:45, Mark Millard wrote:<br>
> > FYI for another issue,<br>
> > <br>
> > I would never recommend swapping to a file in a file system (vnod= e),<br>
> > especially to a zfs file:<br>
> > <br>
> > QUOTE ( <a href=3D"
https://bugs.freebsd.org/bugzilla/show_bug.cgi= ?id=3D206048#c7" rel=3D"noreferrer" target=3D"_blank">
https://bugs.freebsd.= org/bugzilla/show_bug.cgi?id=3D206048#c7</a> )<br>
> > On 2017-Feb-13, at 7:20 PM, Konstantin Belousov <kostikbel at =
<a href=3D"
http://gmail.com" rel=3D"noreferrer" target=3D"_blank">gmail.com= </a>><br>
> > wrote on the freebsd-arm list:<br>
> > <br>
> > . . .<br>
> > <br>
> > swapfile write requires the write request to come through the fil= esystem<br>
> > write path, which might require the filesystem to allocate more m= emory<br>
> > and read some data. E.g. it is known that any ZFS write request<b=
> > allocates memory, and that write request on large UFS file might = require<br>
> > allocating and reading an indirect block buffer to find the block=
number<br>
> > of the written block, if the indirect block was not yet read.<br> > > <br>
> > As result, swapfile swapping is more prone to the trivial and<br> > > unavoidable deadlocks where the pagedaemon thread, which produce = free<br>
> > memory, needs more free memory to make a progress.=C2=A0 Swap wri=
te on the<br>
> > raw partition over simple partitioning scheme directly over HBA a= re<br>
> > usually safe, while e.g. zfs over geli over umass is the worst co= nstruction.<br>
> > END QUOTE<br>
> > <br>
> > I have in the past suffered such consequences.<br>
> <br>
> That's good to say because everybody is saying that it is not<br>
> recommended but most of the time people have no first hand experience = of<br>
> a failure.<br>
> <br>
> While this system have a few GBs of swap I removed it temporarily and = I<br>
> used a zvol for swap. When I am done it will have the traditional swap=
> partition...<br>
Well, IIUC, using zvol for swap still has some risk.<br>
zvol gives functionalities of underlying pool like checksumming,<br>
if configured as such, also compression and crypt.<br>
Of course this functionalities consumes memories.<br>
So, not sure how OpenZFS is impmemented, it should mis-behave<br>
(including panics / crashes) under heavy thrushing situations<br>
unless memories needed for the features are statically allocated<br>
and strictly pinned to physical memory.<br>
Swap partitions are the safest.<br></blockquote><div><br></div><div>This is=
absolutely true. You can swap to raw partitions without allocating</div><d= iv>additional memory (and when the write is complete, free up the memory</d= iv><div>for other things). With zvol, there's many memory allocations n= eeded to</div><div>do the I/O, which can deadlock in low memory situations = (eg, you need</div><div>memory to free memory and can't until memory is=
freed...).</div><div><br></div><div>zvols are great for a large variety of=
things. swap partitions aren't one</div><div>of them, except in very l= imited circumstances where you have a little</div><div>memory pressure to f= orce things out, but are never running anywhere</div><div>close to the edge=
. Not 'rarely' but 'never'.</div><div><br></div><div>Warner= </div></div></div>
--0000000000005f63dc064882493e--
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to
news-admin@muc.de
--- Synchronet 3.21a-Linux NewsLink 1.2